doushang8512 2012-11-03 06:28
浏览 110
已采纳

PHP GET函数为NULL

I want to use GET in PHP and I know how to. The only problem is when I start my page I dont have a ?var=... on it. For example my site is

http://localhost/q/question.php

and in my code is

$num = $_GET['num'];

And I want to assume that if $num == NULL or has not been defined as in the link above.

I will generate a different page. because as example below just determines I am starting the questions in what ever page.

No num variable = Start Generating questions in array.

http://localhost/q/question.php?num=1
  • 写回答

2条回答 默认 最新

  • du1913 2012-11-03 06:30
    关注
    if(isset($_GET['num')){
    header('Location: someotherpage.php');  //redirects user to someotherpage.php
    //do something
    }
    else{
    //do something else
    
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 matlab求解平差
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办