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