Public indicates global and can be accessed by external subclass inside the class;
CopyCode The Code is as follows:
Class test {Public $ name = 'janking ',$ Sex = 'male ',$ Age = 23;
Function _ construct (){Echo $ this-> age. ''. $ this->
Knowledge Point introduction:1. Determine whether a file or directory has a bool
Copy codeThe Code is as follows: file_exists (string filename)
2. Get the file nameCopy codeThe Code is as follows: basename (filepath)
3. open the fileCopy codeThe
Generate a QR code online using the api that generates a QR code online by google.
The Code is as follows:
Copy codeThe Code is as follows:
QR code generation -www.jbxue.com
$ Content = $ _ GET ['content'];
$ Width = $ _ GET ['width']? $
PHP itself does not have multithreading, but it can produce the same effect by means of curves. For example, the asynchronous calling of multi-process mode is limited to the command mode.
In addition, a simpler method can be used in Web programs,
When a Web server executes a PHP script, it sometimes takes a long time to return the execution result. The subsequent script takes a long time to continue execution. To execute the next operation without waiting for the execution result, you can
Php5.3 comes with php-fpm/Usr/local/php/etc/php-fpm.confPid = run/php-fpm.pidPid settings, var/run/php-fpm.pid in the installation directory by default, it is recommended to enable
Error_log = log/php-fpm.logError log, var/log/php-fpm.log in the
Here we will introduce two good php collection tools. One is Snoopy and the other is simple_html_dom. There are many ways to collect data (in essence 2-3, others are derived). php can also directly collect data using several methods. However, out of
Summary of optimizing PHP code skills1. If a method can be static, declare it as static, and the speed can be increased by 1/4;2. The echo efficiency is higher than that of print. Because echo does not return a value, print returns an integer;3. Set
PHP unlimited classification, Google will find a lot of relevant information, the idea is more popular, but also a lot of use is that the classification table has at least three fields: id, pid, name, id auto-incrementing table category, pid is the
The binary method is used to check whether an array contains a certain element. It is compatible with positive and negative order. The code is implemented as follows:
Copy codeThe Code is as follows:
$ SearchValue = (int) $ _ GET ['key'];
Function
Observer mode:Defines a one-to-many dependency between objects. When the status of an object changes, all objects dependent on it are notified and automatically updated.
Observer class:1. Abstract topic role: the topic role stores all references to
Nginx CacheNginx has two caching mechanisms: fastcgi_cache and proxy_cache.Let's talk about the differences between the two cache mechanisms.Proxy_cache is used to cache the content of backend servers. It may be any content, including static and
Previously, I manually wrote a drop-down auto-completion function, which is simple to write. It only supports the mouse selection function and does not support keyboard selection. This function is used in many projects, so you need to do it
In the past, the object orientation was limited to the rote memorization model. After working for so long, it turned to be an experience for everyone to see.1. finalFinal: php5 adds a final keyword. If the method in the parent class is declared as
Factory mode: The factory class determines the type of production slice instance to be created based on the parameter.Factory class: A method class dedicated to creating other objects. That is, pay-as-you-go allocation. input parameters are selected
SetType-set the variable type
Bool settype (mixed $ var, string $ type)Set the var variable type to type.
The possible value of type is:
• "Boolean" (or "bool", starting from PHP 4.2.0)• "Integer" (or "int", starting from PHP 4.2.0)• "Float"
Copy codeThe Code is as follows: // Http://www.jb51.net/article/23093.htm
Function set_cache ($ name, $ value ){
// Set relative or absolute directories. Do not add "/" at the end "/"
$ Cache_dir = "./cache ";
// Set the extension
$ Cache_extension =
Bool
Assert(Mixed $ assertion [, string $ description])-check whether an asserted is
FALSE
Copy codeThe Code is as follows: assert_options (ASSERT_ACTIVE, true); // you can use the assert () function.
Assert_options (ASSERT_WARNING, false); // no
The Code is as follows:
Copy codeThe Code is as follows: // The observed abstract class
Class Observed implements SplSubject {
Protected $ _ name;
Protected $ _ observers;
// Instantiate to generate an observer objectPublic function _ construct (){$
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