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 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.
You have downloaded the wampserver and will try to run ThinkPHP locally later.
In the app/lib/Action/folder, you can define a controller class for each module. A module can contain multiple operation methods. When there is a request, the module and
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 A method of ThinkPHP is used to instantiate the Controller internally. The call format is as follows:
A ('[Project: //] [group/] module', 'controller layer name ')
The simplest usage:
$ User = A ('user ');
The UserAction controller of the
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
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
The grouping function of ThinkPHP is a very useful feature widely used by developers. It can solve the problem of too many MVC hierarchical files in medium and large projects, which makes it difficult to manage.
The independent grouping function
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 ){
When using PHP to do things, I found a problem, which can be simply attributed to garbled code, but this problem is not caused by the function itself. To see who is the culprit.
Suspect: base64_encode and base64_decode
Crime: I wrote a jump and
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,
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
In PHP programs, processing time is often encountered, for example, determining how long a user has been online and how many days has been logged on, the time difference between two posts or the log records between different operations. In this
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