In the previous series of articles, I was concerned about re-organizing your function in one of the PHP Miscellaneous "refactoring-improving the design of existing code", but I still didn't think I made it clear, I also have a lot of things I don't
Today, phpmysql and apache are configured mainly in source code. For more information, see Apache.
Linux: ubuntu 12.04
The configuration of php mysql and apache is completed today.
Mainly source code configuration,
Apache version 2.4.2
Php versions 5
For php performance problems, the _ autoload () method is the most widely discussed method. many people have mentioned that this method has a great impact on performance. Some people say that opcode can also affect the _ autoload () method, so I
Write the database username, password, and other information to the configuration file config. in php, include or require in the file that needs to reference the configuration file content, and use the global keyword in the function to compile the
Multiple design modes are used in ZendFramework. The database encapsulation uses the factory model. First, we will introduce some concepts:
Factory mode: defines a class to create instances of other classes. the created instance usually has its own
Php generates a thumbnail code. For more information, see. the transfer process is relatively long because the image data volume is large, you often want to display a thumbnail of an image. although you can scale the image at will by specifying the
The UNIX timestamp and the formatting date are two time representation forms that we often deal with. The Unix timestamp is easy to store and process, but not intuitive, and the formatting date is intuitive, however, it is not as easy to process as
Sprintf definition and usage. the sprintf () function is used to write formatted strings into a variable. Syntax
sprintf(format,arg1,arg2,arg++)
Parameters
Description
Format
Required. Conversion format.
Arg1
The relationship between PHP hollow strings, 0, null, empty, and false is always uncertain for so long. Which method function should be used for processing? if the method function is used incorrectly or is used less, if the logic sequence of several
If the same key name exists in the same array, the value of the previous key name will be overwritten:
The result of array ("a") + array ("B") is ___
A. array ("a", "B ")B. array ("B", "")C. array ("B ")D. array ("")
Answer: D
Why does the
Php magic methods _ get () and _ set () are introduced. if you need them, refer to the instructions in the official php documentation:
_ Set () is run when writing data to inaccessible properties.
_ Get () is utilized for reading data from
PHP references some pointers similar to the C language, but some important features are different from the C language pointers. if you do not pay attention to them, it will lead to a program BUG. foreach operates on copying an array or object, but
When optimizing the database or importing data, you can know which data table in a database has the most data, sometimes it is helpful for us, so we simply write a few lines of code to achieve the above requirements.
Execution result:
The
The following methods can be used to match keywords and perform special processing on the keywords respectively. For more information, see
The code is as follows:
Header ("Content-type: text/html; charset = utf-8 ");
Function
It is mainly implemented using curl and requires php support for curl.
The code is as follows:
Header ("Content-Type: text/html; charset = utf-8 ″);
If (isset ($ _ GET ['Number']) {
$ Url = 'http: //
The unlink () function deletes files, the mkdir () function creates directories, and the rmdir () function deletes directories. these methods are often used in file-related processing methods, you may want to know about unlink () function deletion
This is a question I encountered in the php interview questions. The Singleton mode literally means that a class has only one instance. the benefits of doing so are great, such as database connection, we only need to instantiate the instance once
Use PHP to generate a single HTML document from the document data in the database. First, it is beneficial to search engines. Second, avoid exposing fields in the database to the address bar and give the code more securely:
The code is as follows:
A php class used to learn how long your program runs. For more information, see
The code is as follows:
Class Timer {
Private $ StartTime = 0; // The start time of the program.
Private $ StopTime = 0; // end time of the program running
Private
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