PHP knowledge point summary

Source: Internet
Author: User
PHP knowledge point summary? 1 .? DIRECTORY_SEPARATOR ????? Because the separator on the window is "\" and on linux is "/"? This symbol can be used to avoid this problem .?? 2 .? Realpath ????? Returns the absolute path of the object .?? 3. PHP knowledge point summary

? 1 .? DIRECTORY_SEPARATOR

?

?? ? ? Because the separator on the window is "\" and on linux is "/"? This symbol can be used to avoid this problem.

?

? 2 .? Realpath

?

?? ? ? The absolute path of the returned file.

?

? 3. in php, 0 = null is true .?? ?

?

? 4. differences between file_get_contents and file

?

?? ? ? ? File_get_contents returns the object content as a string

?? ? ? ? File? Read the file content to an array by row, and one row is an item in the array.

?

Count (file ("test.txt") // Obtain the number of objects

?

?

? 5. delete a folder in php (if a folder is not empty, an error may occur when you run the file for the first time. This is the second time)

?

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 ()? :? Converts a php object to a json string.

?

?? ? ? ? ? ? Json_decode ($ str, $ boolean )? :? Converts a json string into a php object. if $ boolean is true, an array is returned. Note that the $ str format must be correct and the key must have double quotation marks. Otherwise, the conversion fails.

?

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


? 8 .? _ FILE _ get the absolute address of the current FILE.

?

? 9 .? First open php. ini, open zend_extension = "D: \ develop \ xampp \ php \ ext \ php_xdebug.dll", and open the [xdebug] setting item? ? ? ? ? As long as xdebug. remote_enable = On is enabled, or debugging fails. The xdebug settings of php. ini are as follows :,

?

xdebug.remote_enable=1xdebug.remote_autostart=1xdebug.remote_mode=reqxdebug.remote_host=localhostxdebug.remote_port=9000xdebug.idekey=PhpStorm1
?

?? After setting, start PhpStorm. We use the Open Directory function. the directory here should be a directory under xampp's htdocs, so that we can debug the program in real time. Next we will open the Settings panel, select php, and set the correct php home path. here we can perform php-related unit tests.

?

? ? Note that xampp installation cannot contain spaces and cannot be identified.

?

? 10 .? Php solves the problem of email subject garbled characters

?

?

$ Subject = iconv ("", "UTF-8", "Gaea"); $ subject = "=? UTF-8? B? ". Base64_encode ($ subject )."? = "; // Convert to 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.