无法将参数传递给 include 或 require。
默认
$cat= $cat_map[$cat]['url'];
include("section_common.php");
在“section_common.php”中:
echo $cat;
会议
session_start();
$cat= $cat_map[$cat]['url'];
$_SESSION["cat"] = $cat;
include("section_common.php");
在“section_common.php”中:
session_start();
echo $_SESSION["cat"];
卷曲:
$connecturl = curl_init('http://localhost/section_common.php?cat='.$cat_map[$cat]['url']);
curl_setopt($connecturl,CURLOPT_RETURNTRANSFER,true);
$output = curl_exec($connecturl);
curl_close($connecturl);
echo $output;
查询:
$.ajax({
url: "section_common.php",
type: "GET",
data: {cat:"<?=$cat_map[$cat]['url']?>"},
success: function(data){
$("body").html(data);
}
})