The length of a piece of text to capture a certain physical length display, note that to intercept is not the number of bytes of the string, the UFT-8 of the encoding of Chinese characters is 3 bytes or 4 bytes, when displayed, the Chinese character
This is used in a project. another service is used to do some things. the generated file permissions cannot be read through php, and many methods have not been implemented, if I find it online, I can use c to write a proxy to implement it. I can
Common functions used in php to calculate the string length include strlen and mb_strlen. The following is a comparison of the two functions (encoding method UTF8)
Comparison between strlen and mb_strlenWhen all the characters are English characters,
Use array_map and array_multisort to efficiently process multi-dimensional array sorting implementation code. The general method for sorting multi-dimensional arrays is
1. obtain the sorted data and put it into the array $ arrSort. The Middle-key
In fact, we can also set the permissions for each folder so that apache users can only execute what we want it to do, and create a single read/write user for each directory. 1. prevent jumping out of the web Directory
First, modify httpd. conf. if
A useful function in PHP, parse_url, is especially convenient for information capture analysis. For example:
The code is as follows:
$ Url = "http://www.electrictoolbox.com/php-extract-domain-from-full-url ";
$ Parts = parse_url ($ url );
Output:
It is often seen that there are first PHP friends who have no advice on php program problems. this is a little experienced phper will use the following methods to solve the problem.
1. check the error output, check the source code from the output
PHP 5 operates the basic MySQL database code, so remember, thanks a few times, even getting started with database operations. You can learn some string processing methods later or later.
1. establish a database connection
The code is as follows:
Memcache is generally used for cache services. However, for example, a message broadcast system requires a message queue. Messages are retrieved directly from the database, and the load is usually not good. If you cache the entire message queue with
The cache application implementation code in the smarty template engine in php. For more information, see.
1. Smarty cache configuration:
The code is as follows:
$ Smarty-> cache-dir = "directory name"; // create a cache directory name
$ Smarty->
The traffic on one server is relatively large. due to the needs of the program, the session expiration time is set to 3 hours, resulting in the accumulation of nearly 0.2 million session files under tmp. As a result, the cpu usage of the kernel
The functions of this class are very powerful Today. they can not only send html emails, but also send attachments. The functions of this class are very powerful Today. they can not only send html emails, but also send attachments.
The intval function has the following features: Conversion starts only when a number or positive or negative sign is encountered, and the conversion ends when a non-number or string ends, in some applications, due to insufficient understanding of
As the popular PHP language continues to evolve, many new features make it more object-oriented. This article uses some PHPV5.3 instances to demonstrate delayed static binding, namespace support, class method overloading, variable parsing, and
A php variable is stored in a place called "zval". what does a zval structure contain? it contains the type and value of the variable, and two additional bitwise metadata, the first bit is called "is_ref", which is a Boolean value. it identifies
HiChina whois provides valid interfaces for HiChina. Xinnet whois is not provided by Xinnet. it only implements WHOIS based on the url modification of Xinnet's own website.
HiChina whois (the interfaces used provide valid interfaces for HiChina)
As a popular Web programming language, the biggest advantage of PHP is speed. PHP is already doing very well in this regard, and you can hardly find a script programming language that is faster than it. However, if your application load is large and
PHP itself has some problems with the old version, such as some serious bugs before php4.3.10 and php5.0.3, so we recommend that you use the new version. In addition, the vigorous SQLInjection is also widely used in PHP, so to ensure security, PHP
Regular expressions (RegularExpression, abbreviated as regexp, regex or regxp), also known as regular expressions, regular expressions or regular expressions, or regular expressions, it refers to a single regular expression used to describe or match
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