我試圖發送user_id在url我登錄後得到的身份證符合。以下是代碼 extract($ _ POST);如何使用php在頭中發送變量值?
$result = $dbg->prepare("SELECT `p_id`,`email` FROM `complit_register_provider` WHERE `email`=:hjhjhjh AND `password`=:psspsps") ;
$result->bindParam(':hjhjhjh', $login_mail);
$result->bindParam(':psspsps', $login_password);
$result->execute();
$rows = $result->fetch(PDO::FETCH_ASSOC);
$row=$result->rowCount();
if($rows){
$result=$result->fetch(PDO::FETCH_ASSOC);
$_SESSION['Uname']=$rows['email'];
$_SESSION['Utype']="provider";
$_SESSION['Uid']=$rows['p_id'];
$user_id=$_SESSION['Uid'];
header('Location: http://127.0.0.1/pages/user_index/provider/user_profile/show_own_profile.php?Show=$user_id');
}
但它不工作。顯示的網址類似。
http://127.0.0.1/pages/user_index/provider/user_profile/show_own_profile.php?Show= $ USER_ID, 它應該顯示例如像 http://127.0.0.1/pages/user_index/provider/user_profile/show_own_profile.php?Show=9 我怎樣才能做到這一點?
嚴重不你看,單引號? PHP不要解析變量在單引號http://php.net/manual/en/language.types.string.php –