This article mainly introduces the difference between date and gmdate in PHP and the default time zone settings. For more information, see
I. What is the difference between date and gmdate?The PHP time function has two formatting functions: date () and gmdate (). the descriptions in the official documents are:
The code is as follows:
Date () #-format a local ti
PHP itself has some problems with the old version, such as php4.3.10 and php5.0.3 before there are some serious bugs, so we recommend the use of the new version. In addition, the current noisy and vigorous SQL injection also has a lot of use in PHP, so to ensure that
Security, PHP code writing is on the one hand, PHP c
The php file should be stored as ANSI, and code can be changed when encoding.
Copy Code code as follows:
Coding for gb2312, most of the Web page is still used gb2312, a small part with Utf-8,
Www.baidu.com unexpectedly two all use, so read Baidu's web page How to do is no problem
Header (' content-type:text/html; charset=gb2312 ');
Encoded as Utf-8
timeouts, and so on.
In addition, file_get_contents is much better than several of the above functions, so the use of file_get_contents should be given priority. But ReadFile looks better than file_get_contents performance. Because it does not need to invoke fopen.
Copy Code code as follows:
$ctx = stream_context_create (Array (
' http ' => array (
' Timeout ' => 1//Set timeout
)
)
);
Echo file_get_contents ("http://www.baidu.com/", 0, $ctx);
?>
7.fpasst
Features of inputfile in form and its usage in php. the parameter settings in ini are as follows: 1. the size of the original file to be uploaded for the Control lt; input nbsp; type = "file" gt; is 4 MB. the default size of the file to be uploaded is very small, it seems that it is only about 10 MB. I forgot the details. The usage features of the input file required for the Web. C form and related param
Set the current output time in the local time zone of php: lt ;? Php $ time = date ('Y-m-dH: I: s'); echo $ time; hour? How is it 2009-02-2606: 52: 58. The local time (Shanghai) is clearly: 2009-02-2614: 52: 58. my time is in advance for the next 8 hours. :) You have set the local time zone in php.
Output Current time
PHP's mail function to send UTF-8 encoding Chinese mail when the title garbled solution,
Recently encountered a problem, is to use the PHP mail function to send UTF-8 encoded Chinese messages when the title garbled phenomenon, and the message body is correct. Originally thought is the page coding problem, found that the page encoding Utf-
dynamically converted.
There are at least four methods for dynamic conversion of GB-> UTF-8 encoding:
Extended conversion using PHP iconv
Extended conversion using PHP mb_string
Use swap table conversion, swap table stored in MySQL database
Convert tables with swap tables and store them in text files.
The first two methods can be used only when the server has ma
PHP about UTF-8 Chinese garbled solution
1. Use the form to submit, post or Get methods can be.When committing the word "person" in this way, if you are using the Get method, you will find. IE Address bar on the URL is not found "people" word, see is "%4e%ba%ba", because the IE form to submit, is automatically carried out. UrlEncode encoding, and in the search page to receive variables,
PHP about UTF-8 Chinese garbled solution
1. Use the form to submit, post or Get methods can be.When committing the word "person" in this way, if you are using the Get method, you will find. IE Address bar on the URL is not found "people" word, see is "%4e%ba%ba", because the IE form to submit, is automatically carried out. UrlEncode encoding, and in the search page to receive variables,
Encoding:
Edit settings-General-Workspace-right text file encoding-select other, change to UTF-8
Text file encoding in its properties dialog box is the UTF-8.
Edit settings-> General-> content types-open the right-> PHP content type (select the file type you need)
When uploading a large file in PHP, you need to set it. Read the settings required when uploading a large file in PHP. Needless to say, you have to find the PHP configuration file php. ini troubles: open php. ini, first find; File
result of the ip2addr function can only be dynamically converted.
There are at least four methods for dynamic conversion of GB-> UTF-8 encoding:
Extended conversion using php iconv
Extended conversion using PHP mb_string
Use swap table conversion, swap table stored in MySQL database
Convert tables with swap tables and store them in text files.
The first two met
Friends who use foreign host space often encounter problems with time zone settings. The PHP script side of the urban settings can be set under PHP.ini date.timezone key value of ' Asia/shanghai ' can be.Friends who use foreign host space often encounter problems with time zone settings. The
Php Upload large file settings,
Open php. ini, first find
;;;;;;;;;;;;;;;;; File uploads;;;;;;;;;;;;;;;;;
Region, which has the following parameters that affect file upload:
File_uploads = on; // whether to allow file upload over http. The default value is on, which is to open upload_tmp_dir; // The file is uploaded to the place where the temporary file is stored
In the IP address- gt; in the evaluation of geographic location conversion, the article mentions that using the ip2addr function to directly read IP addresses is the most efficient to directly read IP database files using the ip2addr function in the evaluation of IP address-> geographic location conversion., compared to using a MySQL database to store IP data, SQL queries are the most efficient. However, the IP database file QQWry. dat is GB2312 encoded. Now I need the geographic location result
PHP configuration file settings upload large files
I will share with you how to modify the php configuration file to set the method for uploading large files and break through the php large file upload restrictions. For more information, see.This section describes how to set the large file upload option in the
can execute commands, including system (), or can view PHP information
Phpinfo () and so on, then we can ban them:
Disable_functions = System,passthru,exec,shell_exec,popen,phpinfo
If you want to disable the operation of any files and directories, you can turn off many file operations
Disable_functions = Chdir,chroot,dir,getcwd,opendir,readdir,scandir,fopen,unlink,delete,copy,mkdir, Rmdir,rename, File,file_get_contents,fputs,fwrite,chgrp,chmod,ch
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.