Skip to content

Instantly share code, notes, and snippets.

@KEINOS
Last active October 14, 2018 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KEINOS/60216162650dfc9fc0f78eff8141a0ac to your computer and use it in GitHub Desktop.
Save KEINOS/60216162650dfc9fc0f78eff8141a0ac to your computer and use it in GitHub Desktop.
[PHP] KEINOS の UTF8 日本語環境の徹底設定(よく使うためのメモ)
<?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