GET&命令 - 不正确 [英] GET & Command - Incorrect

查看:116
本文介绍了GET&命令 - 不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



URL链接:



http://www.site.com/page?Channel=EM



Datas.php

  $ EM_URL = http://site.com/live/em ....

PageView.php p>

 <? echo'$?><?php print $ _GET ['Channel'];打印_URL; ?><?php'; ?> 

屏幕

解析错误:语法错误,意外的T_STRING,期待','或';'

我在做错误的地方?

解决方案

我想,你要做什么 - 从URL获取部分变量名称( $ _ GET [] )。在这种情况下,您应该这样做:

 <?php 
$ var = $ _GET ['Channel ']。 _url;
echo($$ var);
?>

注意:
我真的怀疑这是出于安全原因的好习惯。至少应该去除输入。或为所有定义的可能输入变量使用 switch..case blocks。



参考: PHP手册


I'm trying to make the command but I get an error..

URL Link:

http://www.site.com/page?Channel=EM

Datas.php

   $EM_URL = "http://site.com/live/em...."

PageView.php

      <? echo '$ ?><?php print $_GET['Channel']; print "_URL"; ?><?php '; ?>

Screen:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

Where the error am I doing?

解决方案

I guess, what You're trying to do - to get part of the variables name from the URL ($_GET[]). In this case You should do something like this:

<?php 
    $var = $_GET['Channel'] . '_URL';
    echo($$var);
?>

NOTE: I really doubt it's a good practice for security reasons. You should strip the input at least. Or use switch..case blocks for all defined possible input variables.

Reference: 2nd example in PHP manual.

这篇关于GET&amp;命令 - 不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆