GET&命令 - 不正确 [英] GET & Command - Incorrect
问题描述
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&命令 - 不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!