How does javascript obtain the value of a PHP string array?

Source: Internet
Author: User
How does javascript obtain the value of a PHP string array? & Lt; table & nbsp; cellspacing0 & nbsp; cellpadding0 & gt; & nbsp; & nbsp; & lt ;? $ I0; how does javascript obtain the value of a PHP string array?























$ I = 0;While ($ I <10){$ Qgmw [$ I] = $ xml1-> title [$ I]; // title$ Qgmw [$ I] = mb_substr ($ qgmw [$ I], 0,78, 'utf-8 '); $ qgid [$ I] = $ xml1-> title [$ I]-> attributes ()-> id; // id$ Qgdj [$ I] = $ xml1-> title [$ I]-> click; // number of clicks$ I ++;}Arsort ($ qgdj, SORT_NUMERIC );$ T_id = array_keys ($ qgdj );$ I = 0;While ($ I <7){$ J = $ I + 1;Echo" ";Echo" ";Echo" ";Echo" ";$ I ++;}// Echo $ qg [0];?>
"; Echo $ j.", "; echo""; Echo" ". mb_substr ($ qgmw [$ t_id [$ I], 0, 10, 'utf-8')." "; echo"


Script
Function ()
{
Var str = "";
Str =" ";
Alert (str );

/* During the test, the values of the following two numeric types can be obtained, but the above $ qgmw [0] is of the string type and cannot be obtained. what should I do?
Str = ;
Str = ;
*/
}
A ();
Script
------ Best solution --------------------
Reference:
This is also the test, and it cannot be obtained. it will not work if it is executed here.
Str =" ";

Reference: Do not enclose strings in quotation marks?



Output $ qgmw [0] to see what it is.
Or use the complete syntax var str =' ';
------ Other solutions --------------------
In this way,
Var str = ;

No errors occur for strings, arrays, or objects.

The string is added with "", the array will [], and the object will {}
------ Other solutions --------------------
Reference:
$ Time = date ("Y, m, d ");
$ Mday = date ("D ");
// Var_dump ($ mday );

If ($ mday = 'mon') $ mday = "Monday ";
Else if ($ mday = 'tue ') $ mday = "Tuesday ";
Else if ($ mday = 'wed') $ mday = "Wednesday ";
Else if ($ mday = '......


Paste the executed HTML code.
We can't run it if you paste it to php.

Or you can use firebug to troubleshoot the error.
------ Other solutions --------------------
Learned
------ Other solutions --------------------
Do not enclose strings in quotation marks?
------ Other solutions --------------------
This is also the test, and it cannot be obtained. it will not work if it is executed here.
Str =" ";

Reference:

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.