【问题标题】:Fatal error during creation of an action with zftool使用 zftool 创建操作时出现致命错误
【发布时间】:2015-01-30 21:59:42
【问题描述】:

我正在尝试在 cmd 中为 zendframework 1.12.x 上的一个控制器创建一个操作。 当我尝试创建操作时,出现此错误:

致命错误:在布尔值中调用成员函数 setMethod() C:\程序 Files\ZendFramework-latest\library\Zend\Tool\Project\Context\Zf\ActionMethod.php 在第 198 行。

这是上述函数的代码:

public static function createActionMethod($controllerPath, $actionName, $body = '        // action body') {
   if (!file_exists($controllerPath)) {
       return false;
   }

   $controllerCodeGenFile = >Zend_CodeGenerator_Php_File::fromReflectedFileName($controllerPath, true, >true);
   $controllerCodeGenFile->getClass()->setMethod(array(
       'name' => $actionName . 'Action',
       'body' => $body
       ));

   file_put_contents($controllerPath, $controllerCodeGenFile->generate());
   return true;    } 

我该如何解决这个问题?

【问题讨论】:

    标签: php zend-framework


    【解决方案1】:

    代码的第 6 行有一个 ">" 字符,而在源代码中是

    $controllerCodeGenFile = Zend_CodeGenerator_Php_File::fromReflectedFileName($controllerPath, true, true);
    

    但这应该会导致解析错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-25
      • 2019-04-22
      • 2016-11-18
      • 1970-01-01
      相关资源
      最近更新 更多