A piece of PHP code that cannot output Chinese characters. please provide solutions

Source: Internet
Author: User
A piece of PHP code that cannot output Chinese characters can be solved. & lt ;? Php & nbsp; header (& quot; Expires: Mon, 26Jul199705: 00: 00GMT & quot;); & nbsp; header (& quot; cache-C: a piece of PHP code that cannot output Chinese characters. please solve it.
Header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT ");
Header ("Cache-Control: no-cache, must-revalidate ");
Header ("Pragma: no-cache ");
Include ("connect. php ");
Ini_set ("date. timezone", "Asia/Shanghai ");
$ D1 = date ("Y-m-d ");
$ Query = mysql_query ("select * from item where status <> 'done 'Order by date desc ");
While ($ now = mysql_fetch_array ($ query )){
$ User =" ";
$ User. =" ";
$ User. = $ now ['Serial'];
$ User. =" ";
$ User. =" ";
$ User. = $ now ['name'];
$ User. =" ";
$ User. =" ";
$ User. = $ now ['dep'];
$ User. =" ";
$ User. =" ";
$ Usera = round (-strtotime ($ d1) + strtotime ($ now ['completetime'])/3600/24 );
If ($ usera <0 ){
$ Us = "expired:" + abs ($ usera );
}
If ($ usera> = 0) & ($ usera <= 3 )){
$ Us = "coming soon:" + abs ($ usera );
}
If ($ usera> 3 ){
$ Us = "and:" + abs ($ usera );
}
$ User. = "expired" + $ us;
$ User. =" ";
$ User. =" ";
$ User. = $ now ['status'];
$ User. =" ";
$ User. =" ";
$ User. = $ now ['percent '];
$ User. =" ";
$ User. =" ";
$ User. = $ now ['creator'];
$ User. =" ";
$ User. =" ";
$ User. = $ now ['Date'];
$ User. =" ";
$ User. =" ";
Echo $ user;
}
?>


If ($ usera <0 ){
$ Us = "expired:" + abs ($ usera );
}
If ($ usera> = 0) & ($ usera <= 3 )){
$ Us = "coming soon:" + abs ($ usera );
}
If ($ usera> 3 ){
$ Us = "and:" + abs ($ usera );
}
$ User. = "expired" + $ us;
Why can't I output only the numbers of $ us and the Chinese characters above it: the expiration date is about to expire, and so on?

------ Solution --------------------
This is not js, and the string connection should use. instead of +
Modify all the errors in the file as follows:

$ Us = "coming soon:" + abs ($ usera );

Modify

$ Us = "about to expire:". abs ($ usera );


------ Solution --------------------
This is related to type conversion. + The operator is an arithmetic task, and the result is forcibly converted to a floating point or integer. the preceding string naturally does not exist. Php.net manual describes type conversion.
Use "expiration date:". abs ($ usera );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.