Skip to content

Instantly share code, notes, and snippets.

@KEINOS KEINOS/setUTF8.php
Last active Oct 14, 2018

Embed
What would you like to do?
[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
You can’t perform that action at this time.