脚本宝典收集整理的这篇文章主要介绍了php – 在Codeigniter中的路线 – 找不到404页面,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的控制器
class Support extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('support_model'); $urlarray = array("index","delete"); if(!in_array($this->uri->segment(2),$urlarray)){ $this->viewticket($this->uri->segment(2)); } } public function viewticket($id){ if(!empty($id)){ $this->load->view('templates/LOGged_header'); $this->load->view('support/view'); $this->load->view('templates/footer'); } } }
这是我的routes.PHP
$route['default_controller'] = "welcome"; $route['benefITs'] = 'welcome/benefits'; $route['faqs'] = 'welcome/faqs'; $route['distributors'] = 'welcome/distributors'; $route['contact'] = 'welcome/contact'; $route['purchase'] = 'welcome/purchase'; //login routes $route['login'] = 'login/index'; $route['logout'] = 'login/logout'; $route['404_override'] = '';
localhost / ciPRoj / support / hello-world给了我404 Page Not Found错误
如果我使用退出;在$this-> load-> view(‘templates / footer’);之后,页面显示空白页面.
我没有任何与支持相关的路线,其他方法都有效
在路线上有什么我想念的吗?
谢谢您的帮助.
phpinfo()
之前检查一下).
$config['uri_protocol'] = "REQUEST_URI";
回到主题,您可以通过在routes.PHP文件中使用下面的单行路由来实现:
$route['support/(?!index)(?!delete)(:any)'] = "support/viewticket/$1";
$urlarray = array("index","delete"); if(!in_array($this->uri->segment(2),$urlarray)){ $this->viewticket($this->uri->segment(2)); }
让我知道它是如何工作的.
以上是脚本宝典为你收集整理的php – 在Codeigniter中的路线 – 找不到404页面全部内容,希望文章能够帮你解决php – 在Codeigniter中的路线 – 找不到404页面所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。