PHP Development FAQs

Source: Internet
Author: User

Ajax Aspects: Ajax notation:

In addition, because Ajax is asynchronous flush, cannot output view, in order to view the data during the debugging process, you can write the data that need to be viewed to the file

File_put_contents ("D:/mylog.log", $data. " \ r \ n ", file_append);

JS aspect:

Back to Previous page: History.go (-1) or history.back ();

Refresh this page:

1, Location.reload (false); default = False, which means fetching data from the cache, true means getting the latest page from the server side in Get mode

2,location.replace (URL); This method replaces the item currently cached in history (client) by specifying a URL, so you cannot access the URL that has been replaced by "forward" and "back" after using the Replace method.

the difference between Jquery.min.js and Jquery.js is:min is compressed version, the removal of comments and spaces, mainly used in production environment, without min is with comments and spaces, easy to read the source code, reference one can.

Special note: Referencing two jquery libraries at the same time can cause a conflict.

Time format processing:

1. UNIX timestamp converted to date function: Date ()

General form: Date (' y-m-d h:i:s ', 1156219870);

2. Date conversion to UNIX timestamp function: Strtotime ()

General form: Strtotime (' 2010-03-24 08:15:42 ');

JSON format processing:

Eval and Json.parse

1. Use the Json.parse () method as much as possible to parse the string itself, which captures syntax errors in JSON

2. Using eval in your code is dangerous, especially if you execute third-party JSON data (which may contain malicious code)

String processing:

Chinese string interception:

Mb_substr ($str, 0,4, ' utf-8 '); Intercept the first 5 words

PHP Development FAQs

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.