3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PHPのparse_strで文字列のパラメータを変数に代入しました。

Posted at

PHPでパラメータが文字列で来た時にどうやって変数に持つのかな−とおもったのですが、parse_str()というものがあると教えてもらいました。

以下のように"hoge=aaaaaaaa&piyo=3333"という文字列が来たとして

文字列を変数で受け取る
$hoge = "huga=aaaaaaaa&piyo=3333";
parse_str($hoge);

var_dump($huga);
var_dump($piyo);
出力結果
string(8) "aaaaaaaa"
string(4) "3333"

変数から出力できましたすごい(☝ ՞ਊ ՞)

参考

3
3
5

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?