当您生成Yii 1.x自动生成的应用程序时,应用程序的私有文件yiic
将放置在protected
文件夹中。但是,当我使用它执行时yiic help shell
,会看到以下消息:
It is recommended that you execute this command under
the directory that contains the entry script file of
the Web application.
接着:
* entry-script | config-file: optional, the path to
the entry script file or the configuration file for
the Web application. If not given, it is assumed to be
the 'index.php' file under the current directory.
我想念什么?该protected
文件夹并不是同一个文件夹入口脚本的一个(index.php
)。我是否应该yiic
出于执行控制台命令的目的而将我移到那里?
如果是,那么为什么默认情况下yiic
将protected
文件夹放置在输入脚本所在的位置,而不是在那里?
如果不是,那么为什么要yiic
假设它index.php
与yiic
它本身存在于同一文件夹中,为什么每次都要使用entry-script
flag更改它呢?这根本没有任何意义!
我认为,答案是保留yiic
在protected
文件夹中,该文件夹可通过.htaccess
文件从Web访问进行保护。入口脚本的文件夹不是用这种方式保护的,并且可以通过Web访问。我个人会非常担心转移yiic
到index.php
存在文件的根文件夹。如果这是正确的答案,那么上面引用的此令人困惑的消息的目的是什么?
这个答案似乎支持了我的想法,因为它表明CRON调用应指向yiic
放置在protected
文件夹中,而不是指向根文件夹中的那个。
为什么Yii开发人员将放在yiic
不应有的位置(它index.php
在同一文件夹中寻找,因此在默认的自动生成的应用程序中,它将失败,找不到它)?我应该如何理解这种情况?为什么我每次都被迫使用额外的标志?为什么默认文件夹结构和文件放置不复制,yiic
假定为默认值?
帮助消息的意思是您应该从WebRoot文件夹(index.php所在的位置)执行yiic命令,如下所示:
% cd WebRoot
% YiiRoot/framework/yiic shell
因此yii将自动使用index.php文件来执行其工作...但是,如果您要调用另一个文件(如index-test.php)来执行yii而不是默认的index.php,则可以:
% cd WebRoot
% YiiRoot/framework/yiic shell index-test.php
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句