Introduction to PHP Tutorials-Database Tutorial operations
In this tutorial, we will build a small web site step-by-step, using the following features of PHP and MySQL:1. View the database;2. Edit the records of the database;3. Modify the records
Eval () has a lot of lethality for PHP security. In general, to prevent
The code is as follows
Copy Code
Usage examples
The code is as follows
Copy Code
$string = ' Cup ';$name = '
Intention:
Defines a one-to-many dependency between objects, and when the state of an object changes, all objects that depend on it are notified and automatically updated "GOF95"
Also known as publish-subscribe (publish-subscribe) mode, model-view
Gold map and Baidu map coordinates conversion PHP program
The code is as follows
Copy Code
GCJ-02 (Mars, German) coordinates converted into BD-09 (Baidu) coordinates@param bd_lon Baidu Longitude@param bd_lat Baidu
There is a need for the situation as follows:Two servers, a test server [Apache], a production server [Nginx], product editors use PHP upload in the test servers to upload products in bulk, pictures, after checking,Can synchronize its uploaded
To remove a cookie, you need to ensure that its expiration period is in the past in order to trigger the browser's deletion mechanism
In PHP, we can use the Setcookie () function to set the browser's cookie information.
The common example code for
These two functions implement the overload of the function!!
1. Default parameters
From this above can be seen, if a function inside, not the necessary parameters, add the corresponding default value, you can complete the corresponding function.
If you want to use the PHP output Excel format file, you must use header Content-type:application/vnd.ms-excel to achieve. As follows
The code is as follows
Copy Code
$filename = name. '. XLS ';Header
Seventh chapter (14) Application of object-oriented detailed _ polymorphismPolymorphic applications: Object class objects are copied to a reference to the parent class, and then the method of the parent class is invoked, but the method that executes
Definitions and usage
The Array_rand () function returns the random key name in the array, or if you specify that the function returns more than one key name, the array containing the random key name is returned.
Description
The Array_rand ()
Can read/etc/passwd!
This paragraph.
[File Upload]
PHP automatically supports file uploads based on RFC 1867, let's look at the following example:
The above code allows the user to select a file from the local machine, and the file is uploaded
Use the php Tutorial mail () to send emailsThe mail () function allows you to send emails directly from scripts.If the mail is successfully received, true is returned; otherwise, false is returned.SyntaxMail (to, subject, message, headers,
(Attachments can be included. The code is as follows:Copy code Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd> php mail function sends an email with attachments // You might need to change this line, if you do not use// The default
PHP method: Use the "_ SERVER" array "HTTP_USER_AGENT" of PHP to obtain the information of the user agent on the page to complete this work. The code is as follows:Copy code Echo $ _ SERVER ["HTTP_USER_AGENT"];?> [Winows/chrome] output
Traffic Statistics tools, such as cnzz, Baidu Statistics, and 51, are both very good and powerful. I wrote a simple traffic statistics tool, but I can only count the access time, visitor ip address, access route, and access page, from seo/seo.html
When I was about to install PHP, I suddenly found the answer on the official Ubuntu Forum.In fact, there is a command:Sudo apt-get install php5-gdHow much time is wasted?In addition, use this method to open apache rewrite:Sudo a2enmod
Several advantages of PHP (purely personal opinions)1. Supports a wide range of databases, including SYBASE, MSSQL, ORACLE, and MYSQL.Through ODBC, the support is wider.2. Good cross-platform performance. Supports WINNT, WIN98, LINUX, and UNIX.
String exec (string $ command [, array & $ output [, int & $ return_var])In the third parameter, how can I not receive negative numbers ??Here & $ return_var is the return value of the program. At first, my answer is a negative number.We usually
Php Tutorial support gb2312, uft-8 Chinese and English character truncation function// Intercept the gb2312 Chinese stringFunction mysubstr ($ str, $ start, $ len ){$ Tmps tutorial tr = "";$ Strlen = $ start + $ len;For ($ I = 0; $ I If (ord (substr
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