如果您担心CURL的可用性,则可以使用
file_get_contents()和流。设置如下功能:
function forward($location, $vars = array()) { $file ='http://'.$_SERVER['HTTP_HOST'] .substr($_SERVER['REQUEST_URI'],0,strrpos($_SERVER['REQUEST_URI'], '/')+1) .$location; if(!empty($vars)) { $file .="?".http_build_query($vars); } $response = file_get_contents($file); echo $response;}这只是设置一个GET,但是您也可以发布一个
file_get_contents()。



