Home > Backend Development > PHP Tutorial > PHP 类的有关问题

PHP 类的有关问题

WBOY
Release: 2016-06-13 10:24:56
Original
912 people have browsed it

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);
Copy after login



类源码
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);    }}
Copy after login


这样可以正常输出数组
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)
Copy after login



类源码
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"]);    }}
Copy after login


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

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

header('Content-Type:text/html; charset=utf-8');
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template