dongyang1518 2008-11-19 12:34
浏览 15
已采纳

PHP5 GET变量的可变性和参考

I have the following in a page e.g. /mypage?myvar=oldvalue

$_SESSION['myvar'] = $_GET['myvar'];
$myvar = 'a_new_string'

Now $_SESSION['myvar'] has the value 'a_new_string'

Is this by design?

How can I copy the value of 'myvar' rather than a reference to it?

  • 写回答

5条回答 默认 最新

  • dongxu4023 2008-11-19 14:24
    关注

    register_globals is the invention of the devil. Fortunately in PHP 6.0 it will be entirely disabled. It wasn't just a huge security problem, it makes people confuse. Please turn it off in your php.ini using register_globals = Off More information: http://us2.php.net/register_globals Also you can check the current settings with the command if (ini_get(register_globals)) echo "turn it off! :)';

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改