【发布时间】:2014-03-27 02:15:01
【问题描述】:
当我将 cakephp 从 1.3 升级到 2.0 时,我遇到了错误。 我没有使用任何插件。
我尝试添加 CakePlugin::load('User'); 和 CakePlugin::loadAll();在bootstrap.php 文件中。但仍然出现同样的错误。
请帮忙。
缺少插件
Error: The application is trying to load a file from the User plugin
Error: Make sure your plugin User is in the app/Plugin directory and was loaded
<?php
CakePlugin::load('User');
加载所有插件:如果您希望一次加载所有插件,请在 app/Config/bootstrap.php 文件中使用以下行
enter code hereCakePlugin::loadAll();
注意:如果要自定义此错误消息,请创建 app/View/Errors/missing_plugin.ctp 堆栈跟踪
CORE/Cake/Core/App.php line 365 → CakePlugin::path(string)
CORE/Cake/Core/App.php line 226 → App::pluginPath(string)
CORE/Cake/Core/App.php line 547 → App::path(string, string)
[internal function] → App::load(string)
[internal function] → spl_autoload_call(string)
CORE/Cake/Utility/ClassRegistry.php line 145 → class_exists(string)
CORE/Cake/View/Helper/FormHelper.php line 163 → ClassRegistry::init(string, boolean)
CORE/Cake/View/Helper/FormHelper.php line 196 → FormHelper->_getModel(string)
CORE/Cake/View/Helper/FormHelper.php line 346 → FormHelper->_introspectModel(string, string)
APP/View/Users/profile.ctp line 49 → FormHelper->create(string, array)
CORE/Cake/View/View.php line 929 → include(string)
CORE/Cake/View/View.php line 891 → View->_evaluate(string, array)
CORE/Cake/View/View.php line 460 → View->_render(string)
CORE/Cake/Controller/Controller.php line 952 → View->render(null, null)
CORE/Cake/Routing/Dispatcher.php line 192 → Controller->render()
CORE/Cake/Routing/Dispatcher.php line 160 → Dispatcher->_invoke(UsersController, CakeRequest, CakeResponse)
APP/webroot/index.php line 108 → Dispatcher->dispatch(CakeRequest, CakeResponse)
如果是 APP/View/Users/profile.ctp 则为第 49 行
<?php echo $this->Form->create("User.user_profile_data", array("action" => "/users/profile")); ?>
用户模型
<?php
class User extends AppModel {
var $name = 'users';
var $hasMany = array('Group' =>
array(
'className' => 'Group',
'foreignKey' => 'user_id',
'dependent' => true,
));
function changeDataSource($newSource) {
parent::setDataSource($newSource);
parent::__construct();
}
function validateLogin($data) {
$user = $this->find('first', array('conditions' => array('username' => $data['User']['username'], 'password' => $data['User']['password'], 'status' => 'A')));
if (empty($user) == false)
return $user;
return false;
}
}
?>
【问题讨论】:
-
你能在第 49 行附近添加
APP/View/Users/profile.ctp的代码吗? -
编辑您的原始帖子并注意格式。同时添加您的
User模型。