我有一个项目 Yii。我从控制器调用模型以在表格中显示数据
$model = new NewAccForm();
$post = Post::model()->find($model);
var_dump($post);
我在错误上运行代码:
PHP warning include(Post.php) [<a href='function.include'>function.include</a>]: failed to open stream:
没有这样的文件或目录
E:\wamp\www\yii\framework\YiiBase.php(427) 415 { 416 include($classFile); 417 if(YII_DEBUG && basename(realpath($classFile))!==$className.'.php') 418 throw new CException(Yii::t('yii','Class name "{class}" does not match class
文件“{file}”。',数组(419'{class}'=>$className,
420 '{file}'=>$classFile, 421 ))); 422 break; 423 } 424 } 425 } 426 else 427 include($className.'.php'); 428 } 429 else // class name with namespace in PHP 5.3 430 { 431 $namespace=str_replace('\\','.',ltrim($className,'\\')); 432 if(($path=self::getPathOfAlias($namespace))!==false) 433 include($path.'.php'); 434 else 435 return false; 436 } 437 return class_exists($className,false) ||
interface_exists($className,false);
438 } 439 return true; Stack Trace #0 + E:\wamp\www\yii\framework\YiiBase.php(427): YiiBase::autoload() #1 unknown(0): YiiBase::autoload("Post") #2 – E:\wamp\www\yii\amica\protected\controllers\front\ReportController.php(10):
spl_autoload_call("Post") 05 '1'=>'Mới', 06 '2' => 'Đã Xóa' 07 ); 08 公共函数 actionIndex() { 09 $model = new ReportForm(); 10 $post = Post::model()->find($model); 11 var_dump($post); 12回声“
Thông báo lỗi cho ban quản trị</h1>"; 13 } 14 15 public function actionCreate() { #3
+ E:\wamp\www\yii\framework\web\actions\CInlineAction.php(49): ReportController- >actionIndex() #4
+ E:\wamp\www\yii\framework\web\CController.php(308): CInlineAction->runWithParams(array("r" => "report")) #5
+ E:\ wamp\www\yii\framework\web\CController.php(286): CController->runAction(CInlineAction) #6
+ E:\wamp\www\yii\framework\web\CController.php(265): CController-> runActionWithFilters(CInlineAction, array()) #7
+ E:\wamp\www\yii\framework\web\CWebApplication.php(282): CController->run("") #8
+ E:\wamp\www\yii\framework\web\CWebApplication.php(141): CWebApplication->runController("report") #9
+ E:\wamp\www\yii\framework\base\CApplication.php( 180): CWebApplication->processRequest() #10
– E:\wamp\www\yii\amica\protected\components\WebApplicationEndBehavior.php(24): CApplication->run() 19 // 附加 changeModulePaths 事件处理程序 20 // 并引发它。21 $this->onModuleCreate = array($this, 'changeModulePaths'); 22 $this->onModuleCreate(new CEvent($this->owner)); 23 24 $this->owner->run(); // 运行应用程序。25 } 26 27 // 当 CWebApplication 28 // 或 CWebModule 实例被初始化时,应该引发这个事件。29 public function onModuleCreate($event) { #11
unknown(0): WebApplicationEndBehavior->runEnd("front") #12
+ E:\wamp\www\yii\framework\base\CComponent.php(261): call_user_func_array(array(WebApplicationEndBehavior, "runEnd"), array("front")) #13
– E:\wamp\www\yii \amica\index.php(13): CComponent->__call("runEnd", array("front")) 08 定义('YII_DEBUG') 或定义('YII_DEBUG',true); 09 // 指定在每条日志消息中应该显示多少级调用堆栈 10 defined('YII_TRACE_LEVEL') 或 define('YII_TRACE_LEVEL',3); 11 12 需要一次($yii);13 Yii::createWebApplication($config)->runEnd('front'); #14
+ E:\wamp\www\yii\amica\index.php(13): CWebApplication->runEnd("front")
为什么会出现这样的问题?以及如何解决?谢谢。