![](/img/trans.png)
[英]How can I check if request was a POST or GET request in codeigniter?
[英]How I can create multiple request get/post page url
如何在页面URL中创建多个获取/发布请求?
像这样:
http://www.example.com/?goto=profile&id=11326
我已经尝试过了:
$doVariableprofile = isset($_GET['goto']) ? $_GET['goto'] : null;
if($doVariableprofile == 'profile') {
if(empty($_SESSION['logged'])) require_once('register.php');
}
我如何添加更多请求? 现在我有http://www.example.com/?goto=profile
我尝试这样做http://www.example.com/?goto=profile&id=1
$testt1 = isset($_GET['goto']) ? $_GET['goto']:null;
if($_GET['goto'] == 'profile?id=".$_GET['id']"'){
require_once('profile.php');
}
当我添加到个人资料时,页面不起作用?id =“ $ _ GET ['id']”')
$goto = isset($_GET['goto']) ? $_GET['goto']:null;
$id = isset($_GET['id']) ? $_GET['id']:0;
if($goto == 'profile' && $id != 0){
require_once('profile.php');
}
您需要将这些值分配给变量,如果您直接在'if condition'中写入$ _GET ['id']而这些值不可用,那么您可能会得到
“注意:未定义索引:”错误。
我相信可以这样做
$url = "profile?id=".$_GET['id'];
if($_GET['goto'] == $url){
require_once('profile.php');
}
我知道这可以做的另一件事
if(isset($_GET['goto']) && $_GET['goto']=="profile"){
if(isset($_GET['id'] || $_GET['id']==''){
header("Location: profile.php");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.