我正在尝试使用外部js文件重定向到控制器,以便我的url地址栏看起来像this is not a link我在javascript中的代码如下所示:
u55.style.cursor = 'pointer';
$axure.eventManager.click('u55', function(e) {
if (true) {
self.location.href=$axure.globalVariableProvider.getLinkUrl('TravellerController');
}
});u55是我的“主页”视图文件中链接的id,我的TravellerController如下所示:
<?php
class TravellerController extends CI_Controller {
public function index()
{
$data=$this->get_data();
}
function get_data(){
*some code...*
redirect('TravellerController/create/'.$data);
{
function create(){
*some code...*
}
}
?> 因此,如果我单击链接我url地址字段,则如下所示:
this is not a link
但我希望它看起来像这样:
this is not a link
发布于 2013-05-07 21:24:12
在我看来,您不会根据用户in从数据库中获取登录的用户。当用户登录时,您将这些值存储在会话中,这很好,但您需要在数据库中找到登录的用户。
在模型中添加一个新函数:
function getUser($userid) {
$this->db->select('*');
$this->db->from('profile');
$this->db->where('id', $userid);
$query = $this->db->get()->result();
return $query;
}在你的控制器中改变:
$data['info'] = $this->profileModel->get_all_info();至
$data['info'] = $this->profileModel->getUser($session_data['id']);我不能完全确定你的两个表,所以上面的代码基本上是一个例子。如果您的用户名在表中是唯一的,您还可以使用它从数据库中获取正确的用户。
我希望这会有一点帮助。
https://stackoverflow.com/questions/16420026
复制相似问题