我正在试图找出为什么我在加载页面时找到了404页面。我认为这是因为文件结构,但现在我不确定原因。
myurl.com/mycms/modules/bios/quotes
这是文件结构
root
root/mycms
root/mycms/application
root/mycms/application/modules
root/mycms/application/modules/bios/
root/mycms/application/modules/bios/controllers/quotes
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Quotes extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
//Config Defaults Start
$msgBoxMsgs = array(); //msgType = dl, info, warn, note, msg
$cssPageAddons = ''; //If you have extra CSS for this view append it here
$jsPageAddons = ''; //If you have extra JS for this view append it here
$metaAddons = ''; //Sometimes there is a need for additional Meta Data such in the case of Facebook addon's
$siteTitle = ''; //alter only if you need something other than the default for this view.
//Config Defaults Start
//examples of how to use the message box system (css not included).
//$msgBoxMsgs[] = array('msgType' => 'dl', 'theMsg' => 'This is a Blank Message Box...');
/**********************************************************Your Coding Logic Here, Start*/
// Checks to see if a session is active for user and shows corresponding view page
if ($this->kowauth->isLoggedIn())
{
$bodyContent = "testing"; //which view file
}
else
{
redirect('login', 'refresh');
}
$bodyType = "full"; //type of template
/***********************************************************Your Coding Logic Here, End*/
//Double checks if any default variables have been changed, Start.
//If msgBoxMsgs array has anything in it, if so displays it in view, else does nothing.
if (count($msgBoxMsgs) !== 0)
{
$msgBoxes = $this->msgboxes->buildMsgBoxesOutput(array('display' => 'show',
'msgs' => $msgBoxMsgs));
}
else
{
$msgBoxes = array('display' => 'none');
}
if ($siteTitle == '')
{
$siteTitle = $this->metatags->SiteTitle(); //reads
}
//Double checks if any default variables have been changed, End.
$this->data['msgBoxes'] = $msgBoxes;
$this->data['cssPageAddons'] = $cssPageAddons; //if there is any additional CSS to add from above Variable this will send it to the view.
$this->data['jsPageAddons'] = $jsPageAddons; //if there is any addictional JS to add from the above variable this will send it to the view.
$this->data['metaAddons'] = $metaAddons; //if there is any addictional meta data to add from the above variable this will send it to the view.
$this->data['pageMetaTags'] = $this->metatags->MetaTags(); //defaults can be changed via models/metatags.php
$this->data['siteTitle'] = $siteTitle; //defaults can be changed via models/metatags.php
$this->data['bodyType'] = $bodyType;
$this->data['bodyContent'] = $bodyContent;
$this->data['userData'] = $this->users->getUserByUserID($this->session->userdata('userID'));
$roster = $this->kowauth->getRosterList($this->data['userData']->usersRolesID);
$userRoster = array();
foreach ($roster AS $member)
{
$userRoster[$member->id] = $member->rosterName;
}
$this->data['userRoster'] = $userRoster;
$this->data['personalMessages'] = array($this->pmmodel->
getInboxUnreadMessagesCount($this->session->userdata('userID')), $this->pmmodel->
getInboxMessagesCount($this->session->userdata('userID')), $this->pmmodel->
getLast5Messages($this->session->userdata('userID')));
$this->load->view('cpanel/index', $this->data);
}
}
/* End of file quotes.php */
/* Location: ./application/modules/bios/controllers/quotes.php */
htacess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteEngine On
RewriteBase /kowmanager
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
我没有任何自定义路线。
答案 0 :(得分:0)
通常在使用带CI的模块时,您不需要在URL中包含“模块”一词。尝试访问myurl.com/mycms/bios/quotes 可能是您的cms以不同的方式工作,但通常理论是模块中的任何控制器只需使用模块名称然后使用控制器名称即可访问。如果您考虑使用不带模块的CI,则不会在URL中使用“controllers”一词。