Last active
October 14, 2018 19:54
-
-
Save KEINOS/60216162650dfc9fc0f78eff8141a0ac to your computer and use it in GitHub Desktop.
[PHP] KEINOS の UTF8 日本語環境の徹底設定(よく使うためのメモ)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function setEnvAsUTF8JaJP($timezone = 'Asia/Tokyo') | |
{ | |
if (! function_exists('mb_language')) { | |
die('This application requires mb_language.'); | |
} | |
date_default_timezone_set($timezone); | |
setlocale(LC_ALL, 'ja_JP'); | |
mb_language('ja'); | |
mb_internal_encoding('UTF-8'); | |
mb_http_output('UTF-8'); | |
// CLI環境の場合は以下はいらない | |
ob_start("mb_output_handler"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment