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.
PHPで$_REQUEST変数に値を割り当てることは可能ですか? 例えば:
if ($_REQUEST['name'] == "") { $_REQUEST['name'] = "John"; }
はい。$_REQUEST他の変数と同様に変数ですが、事前に入力することができ、スーパーグローバルです。
$_REQUEST
その変数は読み取り専用のようです。グローバル変数を保存したい場合は、次のようにグローバルスコープで新しい変数を作成してみてください:
$GLOBALS['some_var'] = 'new var';
次に、次のように、コードのどこでも値を取得できます。
$your_var = $GLOBAS['some_var'];