Php spl_autoload standard library method, phpspl_autoload
The spl_autoload method in php5 is equivalent to implementing your own _ autoload
It will automatically search for the. php/. inc file with the same name as $ classname under the
PHP Creates Desktop shortcuts and php shortcuts
To create a desktop shortcut using php, we need to use header, InternetShortcut, and some code that I don't understand.
Method:Create a new php file, and then throw the following code into the
Php prompts Warning: file_get_contents (): couldn't resolve
Today, when a Caiji function is used,"
Warning: file_get_contents () [function. file-get-contents]: couldn't resolve host name in ......
However, there was no problem with the local test.
This instance uses ThinkPHP in combination with Ajax and mysql to implement the client communication function, as follows:
1. Use the ajax partial refresh function of js to insert the new record read from the database to the display area of the page.
The R method of ThinkPHP is used to call the operation method of A controller, which is further enhanced and supplemented by method.
Call format of the R method:
R ('[ project: //] [group/] module/operation', 'parameters', 'controller layer name
After the system is initialized, destoon automatically connects to the database and stores the database operation object in $ db. For database operation methods, see the include/db_mysql.class.php function prototype. Examples of common database
1. If yourIf the server supports. htaccess, you do not need to set, The. htaccess rule under the root directory of the website has been set.The rule (reference http://download.destoon.com/rewrite/htaccess.txt) is:
# Destoon B2B Rewrite
To enhance the security of destoon, You need to perform necessary security settings. This article uses Rewrite rule settings to increase website security as an example:
Rule 1:
Blocking non-php extended dynamic files, such as asp and aspx, can
Windows:
Install apache, php, and mysql
Various problems encountered:
1. test. php cannot run. I found that I forgot to add AddType application/x-httpd-php. php in httpd. conf;
2. After setting the configuration file, a warning about the time
Obtain all sub-classes of a category:
Static function getMenuTree ($ arrCat, $ parent_id = 0, $ level = 0, $ all = True) {static $ arrTree; // use static instead of global if (! $ All) $ arrTree = ''; if (empty ($ arrCat) return FALSE; $ level ++;
If base64_encode and base64_decode are used directly, the generated string may not apply to the URL address. The following method can solve the problem:
URL-safe string encoding:Copy codeThe Code is as follows:Function urlsafe_b64encode ($ string ){
To determine whether the uploaded file has been modified, You need to record the md5 value of the uploaded file. Here, record the method for obtaining the md5 value of the file.
Copy codeThe Code is as follows:If (isset ($ _ FILES ['multimedia ']) &
We know that SQL statements are processed in a database. Assume that the process for purchasing a product is as follows:
Sql1: Query product inventory
If (inventory quantity> 0) {// generate order... sql2: inventory-1}
When there is no concurrency,
Still old rules, directly add code
resize ("tu.jpg", "tu_lit.jpg ); echo $ newimage-> GetLastError (); class ImageResize {private $ localimage; // the original image path is private $ remoteimage; // The thumbnail storage path is private $
1. Retrieve all images on the webpage:Copy codeThe Code is as follows:// Obtain the content of the specified address and store it to $ text$ Text = file_get_contents ('HTTP: // www.jb51.net /');// Obtain all the img tags and store them in a
1. If the class method can be defined as static, it should be defined as static as much as possible, and its speed will be increased by nearly four times.
2. $ row ['id'] is 7 times faster than $ row [id.
3. echo is faster than print, and multiple
When using PHP for development, you need to create many similar variables either early or late.
Without many similar variables, you can store data as elements in an array.
All elements in the array have their own IDs, so they can be easily accessed.
Php adds a watermark to an image. It is applicable to images in png, jpg, or gif format. You can specify the watermark position and transparency. The complete code is as follows:
There are many solutions. I will introduce them to webmasters with different permissions.
You have the Server Management permission to modify the php. ini file.
You can directly set memory_limit = 8 M in php. ini; to 12 M or larger. (Note: M is
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