php - 如何使用 CodeIgniter 检索 HTTP $_GET 值

标签 php codeigniter

我坚持在 CodeIgniter 中使用 $_GET 变量,有人可以帮助我吗?

最佳答案

CodeIgniter comes with three helper functions that let you fetch POST, COOKIE or SERVER items. The main advantage of using the provided functions rather than fetching an item directly ($_POST['something']) is that the functions will check to see if the item is set and return false (boolean) if not. This lets you conveniently use data without having to test whether an item exists first. In other words, normally you might do something like this:

if (!isset($_GET['something'])){
    $something = FALSE; 
} else {
    $something = $_GET['something']; 
} 

With CodeIgniter's built in functions you can simply do this:

$something = $this->input->get('something');

取自here .

关于php - 如何使用 CodeIgniter 检索 HTTP $_GET 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5785664/

相关文章:

php - 如何通过 IdItem 更新

php - 闭包如何帮助创建 DSL/fluent 接口(interface) : PHP examples?

PHP Laravel 返回查看 null 变量

CodeIgniter "Unable to load the requested class: iofactory"中的 PHPExcel 错误

codeigniter - chrome codeigniter redis 清除 session 问题

php - 如何删除服务器(cpanel)中所有带有文件的文件夹?我的错误在哪里?

php - 将结果内爆为来自 mysqli_fetch_assoc 的 block ,其中 perf1_id 不能位于同一 block 中

php - 无法找到 css 属性

CODEIGNITER:在Controller中创建库实例,从 View 访问

php - fatal error : Uncaught Error: Call to undefined function mysql_pconnect()