Summary of PHP knowledge points

Source: Internet
Author: User
PHP Knowledge Points Summary

? 1.? Directory_separator

?

?? ? ? Because the delimiter on window is "\" and the delimiter on Linux is "/"? Use this symbol to avoid this problem.

?

? 2.? Realpath

?

?? ?? returns the absolute path where the file resides.

?

? 3. 0==null is established in PHP. ?

?

? 4.file_get_contents and File differences

?

?? ???? file_get_contents returns the contents of the file as a string

?? ???? to read the contents of a file into an array in rows, one line in the array.

?

Count (File ("test.txt"))//number of rows to get the file

?

?

? 5. PHP Delete folder (if there is a folder is not empty for the first time run this file may be error, the second time can be)

?

function Deletedir ($dir) {    if (rmdir ($dir) ==false&&is_dir ($dir)) {          if ($filehandler =opendir ($dir)) { While                 (($file =readdir ($filehandler))!=false) {                       if ($file! = ".") && $file! = "...") {                              $fullpath = $dir. " /". $file;                             if (Is_dir ($fullpath)) {                                     deletedir ($fullpath);                             } else{                                     unlink ($fullpath);                 }} Closedir ($filehandler);          } else{                echo "Permision Deny";}}     

?

6. Json_encode and Json_decode

?

?? ????? Json_encode ()? :? Convert a PHP object to a JSON-formatted string

?

?? ????? Json_decode ($str, $boolean)?: Converts a JSON-formatted string into a PHP object and returns an array if $boolean is true. Note that the format of the $str must be correct, key must have double quotation marks, otherwise the conversion failed.

?

? 7. The PHP string connection uses the. = symbol, not the + = symbol.


? 8. ? __file__ Gets the absolute address of the current file.

?

? 9. ? first Open the php.ini, the zend_extension = "D:\develop\xampp\php\ext\php_xdebug.dll" open, while the [Xdebug] setting open phase????? Xdebug.remote_enable = on to open, otherwise it cannot be debugged. The Xdebug settings for php.ini are as follows:,

?

Xdebug.remote_enable=1xdebug.remote_autostart=1xdebug.remote_mode=reqxdebug.remote_host=localhostxdebug.remote _port=9000xdebug.idekey=phpstorm1
?

?? Set up, start Phpstorm, we use the Open Directory feature, where the directory is preferably a directory under the Xampp Htdocs, so that we can debug the program in real time. Next we want to open the Settings panel, and then choose PHP, set the correct PHP home path, here can be PHP-related unit testing and so on.

?

?? Note that the XAMPP installation can not have spaces, not recognized.

?

? 10. ? PHP Send Message subject garbled solution

?

?

$subject = Iconv ("", "UTF-8", "Gaea"); $subject = "=? UTF-8? B? ". Base64_encode ($subject). "? ="; Converted into base64
  • 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.