I admit that I am not the leader in PHP. However, after reading some PHP information, I think some functions need to be added to it to process database connections and integrate XML. To do this, I think I can create a class to process MySQL
5. Miscellaneous5.1 generate imagesPHP can process images. If you have installed the GD library, you can even use PHP to generate images.Header ("Content-type: image/gif ");$ String = implode ($ argv ,"");$ Im = imagecreatefromgif
When writing a program, no matter how careful we are, making mistakes is always inevitable. These errors often confuse the PHP compiler. If developers cannot understand the meaning of the compiler error messages, these error messages are not only
Source: PHPBuilder.comOriginal Author: Luis ArgerichTranslation: erquanErquan Note: I have not had time to experience PHP5 yet. I just translated an article about foreigners.The following are all translated by erquan. 1st times of doing these things
We can also use random numbers to design any program structure we imagine.First, let's take a look at the random number function rand () provided by PHP (). The rand () function of PHP returns a random integer. The usage is as follows:Rand (min, max)
If you want to take measures to break through the Anti-leech protection, you need to consider using HTTP_REFERER. The corresponding variable in the PHP script is $ _ SERVER ['HTTP _ referer'], which stores the value of HTTP_REFERER.Because direct
During PHP development, if you want to introduce a class from the outside, the include and require methods are usually used to include the file defining this class, however, this may cause a large number of include or require method calls in the new
For the sake of website security, PHP files will not be uploaded. If someone enters your background and uploads a PHP file, all the source code of your website will be saved to him, directly package your code. Therefore, you must control the upload
Copy codeThe Code is as follows:// Common file operation functions// The first part reads, writes, creates, deletes, renames, and so on.// Determine whether a file is readable and writable before file operations.$ File = "test.txt ";If (file_exists (
Instance 11: displays the date stamp and dateCopy codeThe Code is as follows:Echo time (); // returns a string of timestamp in seconds.Echo " ";Echo date ("Y-m-d H: I: s", time () + 8*3600); // format time, + 8*3600 to China time ZoneEcho " ";$ Str =
Integer can be in decimal, octal, or hexadecimal format.In octal notation, the number must start with 0 (0;In hexadecimal notation, the number must begin with 0x (Zero x) or 0X (Zero capital X;Integer Overflow: When an integer overflows, it is
Php address bar uploads Chinese $ _ GET and garbled characters. Usage of urlencode and urldecodeUrl EncodingSyntax: string urlencode (string str );Return Value: StringFunction Type: EncodingFor example:Copy codeThe Code is as follows:$ ChineseName =
Counterfeit referer instance code, mainly used for breaking through anti-leeching, slice, software, etc.The complete program is provided here. You can modify the specific application on your own.The example I provided here is very simple. In fact,
1. When file_get_contents can be used to replace file, fopen, feof, fgets, and other methods, try to use file_get_contents, because its efficiency is much higher! Note the PHP version of file_get_contents when opening a URL file;2. Perform as few
To implement GZIP compression pages, the browser and the server need to support them. In fact, the server is compressed. After being uploaded to the browser, the browser decompress and parse the files. We don't need to worry about browsers, because
The reflection API plug-in method is implemented based on the function of the program at runtime. That is to say, it allows the creation of optional interface methods and detects this interface method when it is used for the first time, these
1. Do not translate html entitiesA basic knowledge: All untrusted input (especially the data submitted by the user from the form) must be converted before output.Echo $ _ GET ['usename'];This example may be output:This is an obvious security risk,
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