你好,我遇到一个问题,搞了一个下午,查不到原因所在。
这个问题是在线自动升级后造成的。
也就是说程序原本可以用,升级后不让用了。
admin.php?s=yitihua&c=home&m=edit&id=4这个连接是有效的,
admin.php?s=yitihua&c=category&m=index&appid=2这个链接报错了,要求登录后台,卡在登录后台页面。准确的说,这个连接下的文件无法验证管理员身份了。
home控制器和Category的写法是一样的啊。
先贴home的
<?php namespace Phpcmf\Controllers\Admin;
class Home extends \Phpcmf\Table
{
public function __construct(...$params)
{
parent::__construct(...$params);
\Phpcmf\Service::V()->assign([
'menu' => \Phpcmf\Service::M('auth')->_admin_menu(
[
'应用概览' => [APP_DIR.'/'.\Phpcmf\Service::L('Router')->class.'/index', 'fa fa-list'],
'新增应用' => [APP_DIR.'/'.\Phpcmf\Service::L('Router')->class.'/add', 'fa fa-clone'],
'更新缓存' => ['ajax:yitihua/home/cache_update', 'fa fa-refresh'],
'help' => [350],
]
),
]);
// 支持附表存储
$this->is_data = 0;
$this->my_field = array(
);
// 初始化数据表
$this->_init([
'table' => 'yth_app',
'field' => $this->my_field,
'order_by' => 'id asc',
]);
// 表单显示名称
$this->name = dr_lang('应用概览');
\Phpcmf\Service::V()->assign([
'field' => $this->my_field,
]);
}
public function index() {
list($tpl) = $this->_List();
// print_r($this->_List());exit;
// 输出模板 后台位于 ./Views/home_list.html
\Phpcmf\Service::V()->display($tpl);
}
//修改
public function edit() {
list($tpl,$data) = $this->_Post(intval(\Phpcmf\Service::L('Input')->get('id')));
$data['seo']=dr_string2array($data['seo']);
$data['unified_user_groups']=dr_string2array($data['unified_user_groups']);
$data['unified_data_source']=dr_string2array($data['unified_data_source']);
$data['unified_template']=dr_string2array($data['unified_template']);
\Phpcmf\Service::V()->assign('data',$data);
\Phpcmf\Service::V()->display('yth_admin_edit_app.html');
}这是Category的
<?php namespace Phpcmf\Controllers\Admin;
class Category extends \Phpcmf\Table
{
public $module; // 模块信息
public $is_scategory; // 选择栏目类型
protected $_is_extend_var = 0; // 继承属性变量
// 上级公共类
public function __construct(...$params) {
parent::__construct(...$params);
// 定义页首的按钮,
\Phpcmf\Service::V()->assign([
'menu' => \Phpcmf\Service::M('auth')->_admin_menu(
[
'应用管理' => [APP_DIR.'/home/index', 'fa fa-list'],
'新增应用' => [APP_DIR.'/home/add', 'fa fa-clone'],
'更新缓存' => ['ajax:yitihua/home/cache_update', 'fa fa-refresh'],
'help' => [350],
]
),
]);
$this->_Extend_Init();
}
// 继承类初始化
protected function _Extend_Init() {
// 初始化模块
$dir = APP_DIR ? APP_DIR : 'share';
// 支持附表存储
$this->is_data = 0;
// 模块显示名称
$this->name = dr_lang('数据一体化[%s]', $dir);
// print_r($this->is_scategory);exit;
// 初始化数据表
$this->_init([
'table' => 'yth_category',
'field' => '',
'show_field' => 'name',
'order_by' => 'displayorder ASC,id ASC',
]);
//栏目涉及到所属应用id
$appid = intval(\Phpcmf\Service::L('Input')->get('appid'));
// 写入模板 快捷按钮
\Phpcmf\Service::V()->assign([
'appid' => $appid,
'uriprefix' => APP_DIR."/category",
'module' => $this->module,
'index_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/index',['appid' => $appid]),
'add_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/add',['appid' => $appid]),
'edit_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/edit',['appid' => $appid]),
'backIndex_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/index',['appid' => $appid]),
'reply_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/index',['appid' => $appid]),
'copy_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/copy',['appid' => $appid]),
'all_add_url' => \Phpcmf\Service::L('Router')->url(APP_DIR.'/category/all_add',['appid' => $appid]),
]);
}
public function index() {
$appid = intval(\Phpcmf\Service::L('Input')->get('appid'));
$data = \Phpcmf\Service::M()->table($this->init['table'])->where('appid',$appid)->order_by('displayorder asc,id asc')->getAll();
if(!empty($data)){
\Phpcmf\Service::M('category')->init($this->init); // 初始化内容模型
$category = \Phpcmf\Service::M('category')->repair($data);
\Phpcmf\Service::V()->assign([
'list' => $this->_get_tree_list($category)
]);
}else{
\Phpcmf\Service::V()->assign([
'list' => ""
]);
}
\Phpcmf\Service::V()->assign([
'list_url' =>\Phpcmf\Service::L('Router')->url(APP_DIR.'/category/index'),
'list_name' => ' <i class="fa fa-reorder"></i> '.dr_lang('栏目管理'),
'move_select' => \Phpcmf\Service::L('Tree')->select_category(
$category,
0,
'name="catid"',
dr_lang('顶级栏目'),
0, 0
),
]);
// 输出模板 后台位于 ./Views/category_list.html
\Phpcmf\Service::V()->display("category_list.html");
}刚开始开发这个应用时,对于迅睿cms是个新手,一边摸索一边写的。
升级框架前,这样写是可以的。
现在无法使用了,我想知道您能不能看出是什么问题。
