電子書籍の厳選無料作品が豊富!

設定(php.ini)での設定では
mbstring.language = Japanese
mbstring.internal_encoding = EUC-JP
mbstring.http_input = auto
mbstring.http_output = auto
mbstring.encoding_stranslation = On
mbstring.detect_order = auto
mbstring.substitute_character = none
mbstring.func_overload = 0
で行っています。

そこで、mb_http_input()関数で設定を見ようと思っても表示されません。これは他の皆様も表示されないのでしょうか?

また、スクリプト上での設定方法
mb_language("Japanese");
mb_detect_order("auto");
ini_set("mbstring.http_input", "auto");
mb_http_output("auto");
mb_internal_encoding("EUC-JP");
mb_substitute_character("none");
ととある本に書いてあったのですが、ini_set("mbstring.http_input", "auto");ではなく、mb_http_input("auto");ではまずいのでしょうか?

初心者なのでわかりやすく教えていただければ幸いです。

A 回答 (2件)

mb_http_input()関数は、設定を確認したり、変更する関数ではありません。


そのためmbstring.http_inputの設定を変更するには
ini_set("mbstring.http_input", "auto");
で行う必要があります。
同様に設定を表示するには
echo ini_get("mbstring.http_input");
とする必要があります。
mb_http_input()が何をする関数かというと入力値があった場合にその入力された文字コードの種類を表示します。$_GET,$_POST,$_COOKIEが全て空の場合には入力値自体がないので何も表示されません。
test.php
<?php
echo mb_http_input();
?>
上のプログラムをhttp://example.com/test.phpでアクセスしても何も表示されませんが
http://example.com/test.php?test=a
でアクセスすればたぶん"ASCII"と表示されます。
またhttp://example.com/test.php?test=てすと
でアクセスすれば入力された文字コードにより
"SJIS"とか"EUC-JP"と表示されるはずです。
    • good
    • 0
この回答へのお礼

早速のお返事、ありがとうございます。mb_http_input()の使い道を勘違いしていたみたいですね。

お礼日時:2005/09/06 16:29

追加ですけど


mbstring.encoding_stranslation = Off
の場合には
mb_http_input()
は表示されません
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!