我有这样的urlhttp://lp.dev/sisters/adab/1但是当我使用(:num)或(:any)获取值1因为路由给我404页面路线如下$route['default_controller']="frontend/home";$route["sisters/adab/(:num)"]="frontend/pages/$1";//Controller:前端文件夹内的pages.phpclassPagesextendsCI_Controller{function__construct(){parent::__construct();$this->name=$this->uri-
我有一个函数要通过cron执行。如果我只是点击urlwww.example.com/TestProjects/codeigniter/controller/function这个函数执行得很好,如果我在cron上设置它不起作用。我尝试将其设置为public_html/TestProjects/codeigniter/controller/function然后通过这样的错误信息public_html/TestProjects/codeigniter/controller/function:Notadirectory谁能帮我在cron上设置这个? 最佳答案
这是我的简单Controller:publicfunction_construct(){parent::_construct();$this->load->helper('url');}publicfunctionview($page="index"){if(!file_exists(APPPATH.'/views/truelove_view/'.$page.'.php')){//Whoops,wedon'thaveapageforthat!show_404();}$this->load->view('truelove_view/templates/header.php');$this
我在CI上的$route上有这个$route['(:any)']='main/index/$1';$route['default_controller']='main/index';$route['404_override']='';$route['translate_uri_dashes']=FALSE;我还从startbootstrap下载了一个bootstrap主题,我搬家了css,fonts,images,js进入根目录,应用程序文件夹所在的位置所以问题在于codeigniter将“css”读取为Controller,因此View无法访问css。我也在看有关如何集成它的教程。[
我有一个这样的数组array(2){[0]=>object(stdClass)#20(4){["id"]=>string(1)"1"["name"]=>string(6)"robert"["height"]=>string(3)"165"["weight"]=>string(2)"81"}[1]=>object(stdClass)#21(4){["id"]=>string(1)"2"["name"]=>string(4)"mike"["height"]=>string(3)"175"["weight"]=>string(2)"69"}}所以,我想更改我的数组值。例如,我想更改["hei
在我的View页面中。我有一个用于输入评论的文本框。在我的codeigniter验证中只允许alpha。我需要在评论字段中允许空格、逗号、点、连字符..这个地方在我的验证集中规则如何$this->form_validation->set_rules('e_comment','Comments','required|alpha'); 最佳答案 要进行自定义验证,您需要使用callback功能。//validationrule$this->form_validation->set_rules('comment','Comments','
我是codeigniter的新手。我刚刚在google的帮助下在CI中创建了一个登录功能,但在这里我在登录时重定向到URL,但它不起作用。这是详细信息重定向后链接是这样的http://localhost/xpensepedia/index.php/home这是给出404错误404PageNotFoundThepageyourequestedwasnotfound.我的Controller是publicfunctionindex(){$this->load->view('header');if(($this->session->userdata('user_id')!="")){redi
我正在使用Codeigniter3.0日历库,我没有在我的CI日历中获取事件文本,而是显示数字上的链接而不是显示事件文本。示例Codeigniter代码:classWelcomeextendsCI_Controller{functionindex(){$this->display($year=null,$month=null);}publicfunctiondisplay($year=null,$month=null){$config=array('show_next_prev'=>TRUE,'show_other_days'=>TRUE,'next_prev_url'=>site_u
为什么在CodeIgniter中我应该总是在相对链接中使用语法base_url+link?例如:link22.php">代替当我声明">在HTML头部?有什么好处? 最佳答案 好问题。短词(在下面使用)CI-代码点火器为什么要使用base_url()??base_url()是一个确定您的项目目标的函数,它充当$_SERVER['REQUEST_URI']在php中这将知道您的实际项目包含在哪里。我们可以在哪里修改/定义base_url()??Path-application/config/Filename-config.php我们可
我目前正在使用codeigniter3.0.3。我尝试使用var_dump(base_url());function获取基本url我得到了这个结果string'http://localhost/'(length=17)但我需要获取带有端口号的基本URL。我是这样在codeigniter3.0.2中获取的string'http://localhost:8000'如何在codeigniter3.0.3中获取带端口号的基本URL。 最佳答案 像这样在config.php中设置base_url$config['base_url']='htt