0

当我运行时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
4

1 回答 1

-1

PHP 现在更依赖于您为服务器设置相关的时区。

在你的 php.ini 中找到这个指令

date.timezone =

给它一个与服务器运行位置相关的值

例如

date.timezone = "Europe/London"
date.timezone = "Asia/Manila"

查看此手册页Manual 以找到有效的时区。

于 2013-09-24T15:41:38.910 回答