How PHP gets the HTTP status
In the project development, sometimes we need to know whether the remote URL address can be accessed properly, to determine its normal or not after the next operation, then in PHP How to get the status of remote
Several methods of PHP passing values in CLI mode
PHP itself is a scripting language that can be used efficiently in command-line environments, but how does the CLI (command line Interface) pass in a value?
Here are the 3 ways I know.
A. getopt
Nginx upload parameter problem, need to pay special attention to client_max_body_size this parameter, otherwise it will interrupt the request in Nginx.
General PHP configuration for file upload parameters php.ini file is as follows:
File_uploads
Using the Curl method to simulate Telnet * Analog login bbs.php100.com
$cookie _file= Tempnam ('./temp ', ' Cookie '); $login _url= ' http://bbs.php100.com/login.php '; $post _fields= ' cktime= 31536000&step=2&pwuser= Enter your username here
PHP calls to the Python module
How do I invoke external programs in PHP?
Here are the steps to proceed:
Environment: Windows XP, php5.3, python2.6.6
1. Install Python (http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi)
2. Add the
A detailed description of the PHP configuration file
;;;;;;;;;;;;;;;;;;; about php.ini;;;;;;;;;;;;;;;;;;;; This file must be named ' php.ini ' and placed in the directory specified by the PHPINIDIR directive in httpd.conf.; The latest version of
In the PHP program, a lot of times will encounter the problem of processing time, such as: Determine how long the user online, a total number of days of login, two posts published the difference between the different operations of the log and so on.
The method of the number of identical elements in PHP statistics array
Associative arrays are generally not grouped and can be grouped by the array_values () function to group statistics!
$arr = Array (' a ' = = ' java ', ' b ' = ' php ', ' c ' =
Completely solve the problem that the PHP session does not change and SessionID remains unchanged
After using the session in ASP. PHP, you will find that the session in PHP is so uncomfortable compared to the session in ASP. In the session with PHP,
There are two known time stamps. Determine if the timestamp is included in the Saturday Sunday.
/*** determine if there is a weekend in the time period. * @author * @version October 10, 2015 17:36:27* @param begin start Time * @param last end time
Determine if a string is a utf-8 or gb2312 function
/*** determines whether the string is Utf-8 or gb2312* @param unknown $str * @param string $default * @return string*/function utf8_gb2312 ($str, $defaul t = ' gb2312 ') { $str = preg_replace ("/
PHP strtotime This function, Strtotime (' N Day ') gets the date of the N days before the current date, an example is as follows:
$days =array ();for ($i =0; $i $days []=date ("y-m-d", Strtotime ('-'. $i. ' Day
Sometimes we need to change the ID of the URL into a non-1,2,3,4 such a regular content, we can use the Hashids this class library.
The generated IDs are taller, compared with ID names like Youtube, Youku, Weibo, and so on, such as: Xnjkxmtc0mdq4
Share a way to use PHP to clear the HTML code of space, line breaks, tabs, comment tags and so on to achieve the purpose of compressing the output of HTML.
/*** Compress HTML: Clear line break, clear tab, remove comment mark* @param $string* The
Use PHP to get the website's Google PR value.
Here's how:
function App_hash_url ($url) {$seed = "Mining PageRank is against GOOGLE's TERMS of SERVICE.";$result =0x01020345;for ($i =0; $i
<>$result ^=ord ($seed {$i%87}) ^ord ($url {$i});$result = (
We know that when using PHP Json_encode to deal with Chinese, Chinese will be encoded, become unreadable, similar to the "\u***" format, but also to a certain extent, increase the amount of data transferred.
Echo Json_encode ("Chinese"); Output: "\
RMB Digital to Chinese capital, is a more common demand, so here to share a function, also counted as a record, in case you will use later!
function Num2rmb ($num) {$c 1 = "0 One and three Woolu qi Ba Jiu"; $c 2 = "split-angle element pick Bai
Give a string, how to determine what it is encoded?
PHP has a function: mb_detect_encoding.
But this thing needs to have a mb_string library, not everywhere can use.
function Is_utf8 ($string) {return Preg_match ('%^ (?: [\x09\x0a\x0d\x20-\x7e] #
Today's PHP framework is endless, I am not an expert in this area, and even can not skillfully use one of them, so I do not recommend, and do not want to discuss what is a framework which does not count the framework. What I'm going to talk about
The following error message may appear in the future PHP environment of PHP5.4:
Notice:only variable references should be returned by reference
Exactly what kind of script would make such a mistake, I would like to give an example:
The
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