Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下のURLが生成されました
http://localhost/_/globe/ProductsList.php?idd=1015
URLを生成するコードは次のとおりです
window.location.href="ProductsList.php?idd=" + val;
1015 を ProductsList.php の PHP セッションに保存する方法はありますか?
あなたがしなければならないことは、$_GET変数を検査することだけです。
$_GET
iddパラメータがキーにあることがわかります。
idd
session_start(); // initialize the session or connect to an existing one. $_SESSION[ "idd" ] = $_GET[ "idd" ];
そのパラメーターが実際にスクリプトに渡されたことを確認し、そうでない場合は、デフォルト値を設定するか、適切なエラーを表示するために、何らかのロジックを含めることができます。