Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codeigniter 代码点火器:can';无法获取在uri段中传递的值_Codeigniter - Fatal编程技术网

Codeigniter 代码点火器:can';无法获取在uri段中传递的值

Codeigniter 代码点火器:can';无法获取在uri段中传递的值,codeigniter,Codeigniter,我目前在获取uri段的值时遇到问题 下面是一个场景 当用户单击此锚定时: <?php echo anchor("site/comment/$row->post_id", "Comment"); ?> 正如您所看到的,链接的第三段上确实有一个值。 现在,当我尝试在查询中获取该值时,如下所示: $comment_data = array( 'post_id' => $this->uri->segment(3), 'date_com

我目前在获取uri段的值时遇到问题

下面是一个场景

当用户单击此锚定时:

<?php echo anchor("site/comment/$row->post_id", "Comment"); ?>
正如您所看到的,链接的第三段上确实有一个值。 现在,当我尝试在查询中获取该值时,如下所示:

$comment_data = array(
        'post_id' => $this->uri->segment(3),
        'date_commented' => date('Y-m-d H:i:s'),            
        );
并将其发送到数据库中,保存的值为零,而假设值为140838624


有什么想法吗?我在这里遗漏了什么?

您尝试过uri段2和4中的内容吗。您甚至可以从uri中获取任何值吗?您可以使用die()和echo对其进行调试。您是否在自动加载的帮助程序中包含了“url”。

检查您的表字段是否为BIGINTyep,然后重试。但是,同样的事情发生了$this->uri->segment\u array()返回什么?如果你回显$this->uri->segment(3),会发生什么?是的,请写var_dump results.”并将其发送到数据库“uri->segment(3)显示了正确的值。当您硬编码一个像
123
这样的值时会发生什么?同样的问题?需要更多的调试结果。
$comment_data = array(
        'post_id' => $this->uri->segment(3),
        'date_commented' => date('Y-m-d H:i:s'),            
        );