thinkphp二次开发控制器不显示 最新版本吗,去对应的文件夹下View/pro/index.html那 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 3.2.2的,这是基于thinkphp的cms,我在想是不是cms本身有什么配置文件没有设置,因为其它本身的 控制器都可以使用的。 对tp熟悉吗?最好了解tp本身的架构,不管那个CMS碰到什么问题都可以搞定仅仅复制一个分组,说不准哪有BUG 会点yii,没看过tp,这两天就在弄,然后就发现问题了 发一下报错的控制器吧...不过我个人建议你把时间分配在学习thinkphp上,不然后面再有其他问题也不好办 复制的控制器:<?phpnamespace Ra\Controller;use Think\Controller;class IndexController extends Controller { public function index($page=1){ if(!is_numeric($page)) { $this->error('参数错误'); } if($_GET['keyword']) { $where['content'] = array('like', "%{$_GET['keyword']}%"); $where['title'] = array('like',"%{$_GET['keyword']}%"); $where['_logic'] = 'or'; $condition['_complex'] = $where; $condition['type'] = 'pro'; $this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select(); $count = M('page')->where($condition)->count(); $this->assign('count',$count); $this->assign('page_now',$page); $this->display('Ra/index'); } else { $condition['type'] = 'pro'; $this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select(); $count = M('page')->where($condition)->count(); $this->assign('count',$count); $this->assign('page_now',$page); $this->theme(mc_option('theme'))->$this->display('Ra/index'); }; }原件:<?phpnamespace Pro\Controller;use Think\Controller;class IndexController extends Controller { public function index($page=1){ if(!is_numeric($page)) { $this->error('参数错误'); } if($_GET['keyword']) { $where['content'] = array('like', "%{$_GET['keyword']}%"); $where['title'] = array('like',"%{$_GET['keyword']}%"); $where['_logic'] = 'or'; $condition['_complex'] = $where; $condition['type'] = 'pro'; $this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select(); $count = M('page')->where($condition)->count(); $this->assign('count',$count); $this->assign('page_now',$page); $this->display('pro/index'); } else { $condition['type'] = 'pro'; $this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select(); $count = M('page')->where($condition)->count(); $this->assign('count',$count); $this->assign('page_now',$page); $this->theme(mc_option('theme'))->display('pro/index'); }; }调试到最后一步的时候就显示404;到$this->theme(mc_option('theme'))这个值还是一样的。就是display输出不行,即使改成原件的也不行 $this->theme(mc_option('theme'))->$this->display('Ra/index');$this->theme(mc_option('theme'))->display('pro/index');你看 呃,不是的,我之前是分开了为了调试,$this->theme(mc_option('theme')); $this->display('Ra/index');然后为了让你看的一样我删除回去没整好.我是直接复制原件了的。 弄了个test.php 输出的模板貌似有问题估计参数没有对上才会跳转404。我再查查、 是不是控制器中全局替换的Ra,而View文件夹下还是pro? 记录访问页面的入口数问题,在线等 关于用PHP解析XML 的方法 require错误。。高手帮我看一下啊。谢谢了 小问题大送分,关于数据打印 两个表查询的SQL这么写? 对查询结果进行分页??? 怎样实现提前提醒? php高手请进来看看 session丢失问题 php session存活时间问题,求帮助 几行源代码,报错,可我怎么也没看出有什么错误 php 数组合并的问题
3.2.2的,这是基于thinkphp的cms,我在想是不是cms本身有什么配置文件没有设置,因为其它本身的 控制器都可以使用的。
仅仅复制一个分组,说不准哪有BUG
不过我个人建议你把时间分配在学习thinkphp上,不然后面再有其他问题也不好办
<?php
namespace Ra\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index($page=1){
if(!is_numeric($page)) {
$this->error('参数错误');
}
if($_GET['keyword']) {
$where['content'] = array('like', "%{$_GET['keyword']}%");
$where['title'] = array('like',"%{$_GET['keyword']}%");
$where['_logic'] = 'or';
$condition['_complex'] = $where;
$condition['type'] = 'pro';
$this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select();
$count = M('page')->where($condition)->count();
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->display('Ra/index');
} else {
$condition['type'] = 'pro';
$this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select();
$count = M('page')->where($condition)->count();
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->theme(mc_option('theme'))->$this->display('Ra/index');
};
}
原件:
<?php
namespace Pro\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index($page=1){
if(!is_numeric($page)) {
$this->error('参数错误');
}
if($_GET['keyword']) {
$where['content'] = array('like', "%{$_GET['keyword']}%");
$where['title'] = array('like',"%{$_GET['keyword']}%");
$where['_logic'] = 'or';
$condition['_complex'] = $where;
$condition['type'] = 'pro';
$this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select();
$count = M('page')->where($condition)->count();
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->display('pro/index');
} else {
$condition['type'] = 'pro';
$this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select();
$count = M('page')->where($condition)->count();
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->theme(mc_option('theme'))->display('pro/index');
};
}
调试到最后一步的时候就显示404;到$this->theme(mc_option('theme'))这个值还是一样的。就是display输出不行,即使改成原件的也不行
$this->theme(mc_option('theme'))->display('pro/index');
你看
是不是控制器中全局替换的Ra,而View文件夹下还是pro?