>백엔드 개발 >PHP 튜토리얼 > PHP 类的有关问题

PHP 类的有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB원래의
2016-06-13 13:30:04878검색

PHP 类的问题
调用源码

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
$obj_car = new class_car;
$num_carId = $obj_car->fn_carAdd($_POST);




类源码
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
class class_car {
    function fn_carAdd($arr_post) {
        print_r($arr_post);
    }
}



这样可以正常输出数组
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
Array
(
    [action_post] => carAdd
    [str_postChk] => 
    [str_carName] => 高尔夫
    [num_carBrand] => 7
    [num_carModel] => 615
    [str_carEmiss] => 1.4T
    [str_carTrans] => MT
)




类源码
PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
class class_car {
    function fn_carAdd($arr_post) {
        print_r($arr_post["str_carName"]);
    }
}



这样输出乱码,求解,文件本身编码都没问题

------解决方案--------------------
header发送编码。
加在程序开始就行了。

header('Content-Type:text/html; charset=utf-8');
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.