Php 在codeigniter中呈现视图时如何传递数据或数据数组?
我的网址是:Php 在codeigniter中呈现视图时如何传递数据或数据数组?,php,codeigniter,Php,Codeigniter,我的网址是: http://localhost/CodeIgniterCms/admin/dashboard/otherpages/123 在哪里, 编码点火器 - admin -- dashboard (the controller) --- otherpages (Method) 控制器代码 public function otherpages($somedata) { $this->render('admin/second_view',$somedata); } sec
http://localhost/CodeIgniterCms/admin/dashboard/otherpages/123
在哪里,
编码点火器
- admin
-- dashboard (the controller)
--- otherpages (Method)
控制器代码
public function otherpages($somedata) {
$this->render('admin/second_view',$somedata);
}
second_view.php中的代码
但这是一个错误无法加载请求的文件:admin/123.php请在您的
otherpages
函数中尝试此操作:
$data['somedata']=$somedata
$this->load->view('admin/second_view',$data);
您有什么特别的路线吗?因为默认值是localhost/class/function/data/
,并且您的url与之不完全对应。是的,我使用.htaccess删除了index.php,并通过在route.phpc中声明route config路由了我的管理应用程序和公共应用程序。您可以包括相关路由信息吗?我的代码是$this->render('admin/second\u view',$somedata)代码>
实际上,我在应用程序/内核中有一个MY_控制器,它正在为我加载master_页眉和master_页脚呈现模板。我正在嵌入链接,我仅根据该链接创建了我的应用程序。
{link}()
<pre>
<div class="container">
<?php echo $somedata;?>
</div>
</pre>
$data['somedata'] = $somedata; <br/>
$this->load->view('admin/second_view',$data);