小白想用cms二次开发,可是,为什么我在Application下复制了一份然后改名,网页url各种都试了就是不显示,后来一直调试,发现跳到这最后一步 $this->display('pro/index'); 它就显示没找到,我用可以显示的其它控制器里面的$this->display也不显示啊。。。。。。。这是为啥呢?
回复讨论(解决方案)
最新版本吗,去对应的文件夹下View/pro/index.html那
最新版本吗,去对应的文件夹下View/pro/index.html那
3.2.2的,这是基于thinkphp的cms,我在想是不是cms本身有什么配置文件没有设置,因为其它本身的 控制器都可以使用的。
对tp熟悉吗?最好了解tp本身的架构,不管那个CMS碰到什么问题都可以搞定
仅仅复制一个分组,说不准哪有BUG
对tp熟悉吗?最好了解tp本身的架构,不管那个CMS碰到什么问题都可以搞定
仅仅复制一个分组,说不准哪有BUG
会点yii,没看过tp,这两天就在弄,然后就发现问题了。。。
最新版本吗,去对应的文件夹下View/pro/index.html那
我还比对了其它的控制器,传入传出的值什么都是一样的,就是输出模板的时候不行了。直接跳404。。。。。。。
发一下报错的控制器吧...
不过我个人建议你把时间分配在学习thinkphp上,不然后面再有其他问题也不好办
发一下报错的控制器吧...
不过我个人建议你把时间分配在学习thinkphp上,不然后面再有其他问题也不好办
复制的控制器:
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');
};
}
原件:
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输出不行,即使改成原件的也不行
我就粘贴了index的。
$this->theme(mc_option('theme'))->$this->display('Ra/index');
$this->theme(mc_option('theme'))->display('pro/index');
你看
我就粘贴了index的。
呃,不是的,我之前是分开了为了调试,$this->theme(mc_option('theme')); $this->display('Ra/index');然后为了让你看的一样我删除回去没整好.我是直接复制原件了的。
弄了个test.php 输出的模板貌似有问题。。。。。。估计参数没有对上才会跳转404。我再查查、

TheSecretTokeEpingAphp-PowerEdwebSiterUnningSmoothlyShyunderHeavyLoadInVolvOLVOLVOLDEVERSALKEYSTRATICES:1)emplactopCodeCachingWithOpcachingWithOpCacheToreCescriptexecution Time,2)使用atabasequercachingCachingCachingWithRedataBasEndataBaseLeSendataBaseLoad,3)

你应该关心DependencyInjection(DI),因为它能让你的代码更清晰、更易维护。1)DI通过解耦类,使其更模块化,2)提高了测试的便捷性和代码的灵活性,3)使用DI容器可以管理复杂的依赖关系,但要注意性能影响和循环依赖问题,4)最佳实践是依赖于抽象接口,实现松散耦合。

是的,优化papplicationispossibleandessential.1)empartcachingingcachingusedapcutorediucedsatabaseload.2)优化的atabaseswithexing,高效Quereteries,and ConconnectionPooling.3)EnhanceCodeWithBuilt-unctions,避免使用,避免使用ingglobalalairaiables,并避免使用

theKeyStrategiestosiminificallyBoostphpapplicationPermenCeare:1)useOpCodeCachingLikeLikeLikeLikeLikeCacheToreDuceExecutiontime,2)优化AtabaseInteractionswithPreparedStateTemtStatementStatementSandProperIndexing,3)配置

aphpdepentioncontiveContainerIsatoolThatManagesClassDeptions,增强codemodocultion,可验证性和Maintainability.itactsasaceCentralHubForeatingingIndections,因此reducingTightCightTightCoupOulplingIndeSingantInting。

选择DependencyInjection(DI)用于大型应用,ServiceLocator适合小型项目或原型。1)DI通过构造函数注入依赖,提高代码的测试性和模块化。2)ServiceLocator通过中心注册获取服务,方便但可能导致代码耦合度增加。

phpapplicationscanbeoptimizedForsPeedAndeffificeby:1)启用cacheInphp.ini,2)使用preparedStatatementSwithPdoforDatabasequesies,3)3)替换loopswitharray_filtaray_filteraray_maparray_mapfordataprocrocessing,4)conformentnginxasaseproxy,5)

phpemailvalidation invoLvesthreesteps:1)格式化进行regulareXpressecthemailFormat; 2)dnsvalidationtoshethedomainhasavalidmxrecord; 3)


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

安全考试浏览器
Safe Exam Browser是一个安全的浏览器环境,用于安全地进行在线考试。该软件将任何计算机变成一个安全的工作站。它控制对任何实用工具的访问,并防止学生使用未经授权的资源。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

禅工作室 13.0.1
功能强大的PHP集成开发环境

SublimeText3汉化版
中文版,非常好用

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中