>  기사  >  백엔드 개발  >  比方说bb.newmiracle.cn我要访问的效果跟b.php?ab=2&dd=3一样 代码应该怎么写

比方说bb.newmiracle.cn我要访问的效果跟b.php?ab=2&dd=3一样 代码应该怎么写

WBOY
WBOY원래의
2016-06-23 13:46:07863검색

比方说bb.newmiracle.cn我要访问的效果跟b.php?ab=2&dd=3一样  代码应该怎么写


13.php
include 'http://localhost/ceshi/12.php?name=Peter';
?>

12.php



运行13.php是空白。。



回复讨论(解决方案)

你以 url 方式嵌入文件,需要打开 allow_url_include 开关

echo file_get_contents('http://localhost/ceshi/12.php?name=Peter&'.http_build_query($_GET));

13.php改成以下??。

<?phpecho file_get_contents('http://localhost/ceshi/12.php?name=Peter');?>

echo file_get_contents('http://localhost/ceshi/12.php?name=Peter&'.http_build_query($_GET));


http_build_query($_GET));为什么要加这个 不加也可以显示。。

include  也是可以的,但是php.ini 中allow_url_include 要设置为On 


echo file_get_contents('http://localhost/ceshi/12.php?name=Peter&'.http_build_query($_GET));


http_build_query($_GET));为什么要加这个 不加也可以显示。。

就是把你在13.php的get参数 拼 在12.php参数后面
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.