PHP致命错误:找不到类'Inflector'

时间:2015-08-04 16:42:43

标签: php linux cakephp centos cakephp-2.1

我尝试通过以下

运行PHP文件(cakePHP)
 $ /bin/sh /var/www/html/app/Console/cake HumanResource UpdateData

但是发生错误:

PHP Fatal error:  Class 'Inflector' not found in /var/www/html/app/lib/Cake/Console/ShellDispatcher.php on line 209

我服务器中的一些信息:

  • Centos:6.5

  • PHP:5.3

  • Httpd:2.2.15

  • CakePHP版本:2.1.3

请帮我修理一下。感谢

1 个答案:

答案 0 :(得分:1)

你忘了添加:

use Cake\Utility\Inflector;

示例:

<?php

namespace App\Shell;

use Cake\Console\Shell;
use Cake\Utility\Inflector;

class CamerasShell extends Shell {
    public function main() {
        $this->out(Inflector::slug('Please Generate Me Slug', '-'));
    }
}