php
  • class
  • utf-8
  • json
  • ob-start
  • 2014-04-01 2 views 0 likes 
    0

    내 색인PHP는 UTF-8 인코딩

    defined("DS") || define("DS", DIRECTORY_SEPARATOR); 
    defined("ROOT_PATH") || define("ROOT_PATH", realpath(dirname(__FILE__))); 
    require_once(ROOT_PATH.DS.'classes'.DS.'Helper.php'); 
    
    $page = 'default'; 
    
    $uri = $_SERVER['REQUEST_URI']; 
    
    if(!empty($uri)){ 
        $first = substr($uri, 0, 1); 
        if($first == '/') { 
         $uri = substr($uri, 1); 
        } 
        if(!empty($uri)) { 
         $uri = explode('?', $uri); 
         $uri = explode('/', $uri[0]); 
         $page = array_shift($uri); 
        } 
    } 
    
    $content = array(
        'con' => Helper::getContent($page) 
    ); 
    
    if(!empty($_GET['ajax'])) { 
        echo json_encode($content); 
    } else { 
        require_once('temp/temp.php'); 
    } 
    

    내 수업

    class Helper { 
    
        public static function getContent($file = null) { 
         $file = 'content/'.$file.'.php'; 
         if(is_file($file)) { 
          ob_start(); 
          require_once($file); 
          return ob_get_clean(); 
         } 
        } 
    } 
    

    내가 UTF-8 할 수 involved.How 콘텐츠 페이지 혼합 문자를 표시?

    답변

    0

    PHP 스크립트를 사용하여 문자열 here을 다시 인코딩 할 수있는 설명서를 찾을 수 있습니다. 내용은 프랑스 블로그 게시물하지만 스크립트는

    +0

    (utf8_encode, $에서 볼 함유량); temp utf8_encode ($ content [ 'con'])에 대해서도 잘 모르겠다. – Cenk

    0

    아마 중간 페이지에서 간단한 요점입니다 :

    header('Content-Type: text/html; charset=utf-8'); 
    

    이 주제 Set HTTP header to UTF-8 using PHP 내가 인덱스 $ encodedArray = array_map에 사용

    +0

    이것은 작동하지 않습니다. – Cenk

    관련 문제