当我运行cake bake controller all
时,我收到以下错误:
$ ./app/Console/cake bake controller all
Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /Applications/MAMP/htdocs/cakephp/lib/Cake/Cache/CacheEngine.php on line 60
Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead in /Applications/MAMP/htdocs/cakephp/lib/Cake/Cache/CacheEngine.php on line 60
Welcome to CakePHP v2.4.1 Console
---------------------------------------------------------------
App : app
Path: /Applications/MAMP/htdocs/cakephp/app/
---------------------------------------------------------------
You can download PHPUnit from http://phpunit.de
Baking controller class for Accounts...
Creating file /Applications/MAMP/htdocs/cakephp/app/Controller/AccountsController.php
Wrote `/Applications/MAMP/htdocs/cakephp/app/Controller/AccountsController.php`
Bake is detecting possible fixtures...
Warning Error: Argument 1 passed to Component::__construct() must be an instance of ComponentCollection, array given in [/Applications/MAMP/htdocs/cakephp/lib/Cake/Controller/Component.php, line 79]
Fatal error: Call to undefined method Component::getAssociated() in /Applications/MAMP/htdocs/cakephp/lib/Cake/Console/Command/Task/TestTask.php on line 394
Fatal Error Error: Call to undefined method Component::getAssociated() in [/Applications/MAMP/htdocs/cakephp/lib/Cake/Console/Command/Task/TestTask.php, line 394]
但是,如果我单独运行它,它可以工作:
---------------------------------------------------------------
Baking AccountsController
---------------------------------------------------------------
Would you like to build your controller interactively?
Warning: Choosing no will overwrite the AccountsController. (y/n)
[y] > y
Would you like to use dynamic scaffolding? (y/n)
[n] > y
---------------------------------------------------------------
The following controller will be created:
---------------------------------------------------------------
Controller Name:
Accounts
public $scaffold;
---------------------------------------------------------------
Look okay? (y/n)
[y] > y
Baking controller class for Accounts...
File `/Applications/MAMP/htdocs/cakephp/app/Controller/AccountsController.php` exists
Do you want to overwrite? (y/n/q)
[n] > y
Wrote `/Applications/MAMP/htdocs/cakephp/app/Controller/AccountsController.php`
PHPUnit is not installed. Do you want to bake unit test files anyway? (y/n)
[y] > n
答案 0 :(得分:-1)
PHP现在更依赖于您为服务器设置相关时区。
在你的php.ini中找到这个指令
date.timezone =
为其指定一个与服务器运行位置相关的值
例如
date.timezone = "Europe/London"
date.timezone = "Asia/Manila"
请查看此manual page手册以查找有效的时区。