2009-05-09から1日間の記事一覧

phpのマルチバイトを含むUTF-8環境で、Shift-JISのバイト数を取得する方法

PHP

//変換前文字コード $bf = 'UTF-8';//変換後文字コード $af = 'Shift-JIS';$data = "テsと";$byte = strlen(bin2hex(mb_convert_encoding($data, $af, $bf))) / 2;print $byte;結果 5バイトPHPって3回くらいネストすれば、一行で大抵のことは出来ちゃいます…

xampp on windows で.htaccessの設定方法

htdocsに「a.htaccess」「a.htpasswd」を設置renコマンドで.htaccess、.htpasswdに改名する・.htaccessの中身 AuthUserFile ../htdocs/.htpasswd AuthName "Please enter your ID and password" AuthType Basic require valid-user ・.htasswd はlinuxのパス…