首先,我完全打算AJAXify
创建我的整个页面,尽管我首先将每个页面都构建为自己的页面,只是为了清楚起见并避免 AJAX 中涉及的一些前期麻烦。
一切都很好,直到我收到此错误:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: q
Filename: controllers/welcome.php
Line Number: 93
这是我的欢迎代码:
function find($cliqid = '')
{
$search = $this->input->get($q);
$q = $search['q'];
if ($cliqid == '') { $cliq = "Find a new Cliq to Join!"; } else {
$cliq = $this->logic_m->get_cliq($cliqid);
}
$data['page'] = "Create a new cliq under the ".$cliq. " Cliq!";
//build components
$page['head'] = $this->load->view('template/components/head', $data, TRUE);
$page['header'] = $this->components_m->header($cliqid);
$page['cliqbar'] = $this->components_m->cliqbar($cliqid);
$page['content'] = $q;
$page['slideout'] = $this->components_m->slideout();
$this->load->view('template/template' ,$page);
}
这是打开页面的 URL/welcome/find/6/?q=234
$page['content']
实际上是$q
正确显示变量,所以我不确定它为什么会抛出错误,或者如何摆脱它。
谢谢!