你使用 __autoload() 吗?它会兼容所有主机吗?

发布于 2024-08-27 19:06:06 字数 114 浏览 2 评论 0原文

我正在犹豫要不要使用这个机制。 PHP Doc 表示,如果在 CLI 交互模式下使用 PHP,则自动加载不可用。那么,我们是否应该避免使用此方法,以防万一您的应用程序安装在恰好在 CLI 中运行 PHP 的主机中?

I'm hesitating whether or not to use this mechanism. PHP Doc says autoloading is not available if using PHP in CLI interactive mode. So, should we avoid to use this method for just in case, your application get installed in a host happenly running PHP in CLI ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终难遇 2024-09-03 19:06:06

不,不是这个意思。 CLI 交互模式是指在没有脚本的情况下在命令行中启动 PHP 解释器(例如使用 php -a)。您可以在应用程序中使用自动加载,无需担心。

No, that's not what it means. CLI interactive mode is when you start the PHP interpreter in command-line without a script (eg. with php -a). You can use autoloading in your application without worries.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文