Access control
Access control for a property or method is achieved by adding the keyword public, protected, or private earlier.
A class member defined by public can be accessed from anywhere;
A class member defined by protected can be accessed by
The performance of the Require () statement is similar to include (), which includes and runs the specified file. The difference is that, for the include () statement, it is read and evaluated every time the file is executed, whereas for require (),
There are two ways to refer to a file: Require and include. Two ways to provide different use elasticity.
The use of require is as follows require("MyRequireFile.php"); . This function is usually placed at the front of the PHP program, and before
I'm looking at the startup process of Yii2, where application's parent constructor is written like this; I want to ask the last sentence component::construct ($config) What is the special meaning of the call here?
Public Function construct
Trait single case
Examples are as follows
name = ' foo '; }}class Bar {use singleton; Private Function construct () {$this->name = ' bar '; }} $foo = Foo::getinstance (), echo $foo->name; $bar = Bar::getinstance (); Echo $bar->name;
PHP 5 can use type constraints. The parameters of a function can specify data that must be an object type or an array type or a recursive type or a callback type;
var; } /** * Another test function * The first parameter must be an
This article mainly introduces the PHP array key name tips summary, analysis of PHP array key names common use of skills, with a certain reference value, the need for friends can refer to the next
This article summarizes in detail the PHP array
Clevercode found that calling PHP built-in functions in Smarty can be implemented by | | There are no spaces before and after. If it is an array, count needs to be added @.
1 parameters at a time:
{' param1 ' |functionname}}
For example
{{$tmpStr |
The type key for a static variable is static. This article is mainly about using methods and basic examples of static and static methods in PHP, and lazy binding
The static (static) keyword is used to define statically defined methods and
PHP supports namespaces at the beginning of the 5.3.0 version. What is a namespace? In a broad sense, namespaces are a way of encapsulating things. This abstract concept can be seen in many places.
Namespaces Overview
In PHP, namespaces are used to
The first type of
To traverse the entire two-dimensional array with foreach ():
$team = Array (' lk ', ' OK '), $book = Array (' Linux server Configuration and Management ', $team); foreach ($book as $k + $val)//for $book each $value (AS) echo $k. '
development will need to debug code, and PHP debugging code can not be like the language of iOS compiler to step through development software such as Xcode, so developers who develop PHP will usually print related information through the output
first, clear the output sequence of PHP
1. Open the PHP output cache:Echo,print, PHP output_buffring, server buffering, browser buffering display2. The PHP output cache is not open:Echo,print, server buffering, browser buffering, browser
1. Directory Structure:
Where thinkphp subdirectories are the framework core directory
Thinkphp structure:
2. Entry file
The default comes with a portal file located inpublic/index.php
The application directory isapplication,其结构:
indexModule
A switch statement is similar to a series of IF statements that have the same expression. In many cases it is necessary to compare the same variable (or expression) with many different values and execute different code depending on which value it
Here's a small piece to bring you a PHP personnel Rights Management (RBAC) instance (recommended). Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little
This article mainly introduces to you about the solution Laravel 5.1 error: No supported encrypter found related information, the article introduced in very detailed, for everyone has a certain reference learning value, the need for friends can
This article mainly introduces the Laravel log can not be written to solve the problem, the text gives a detailed solution for everyone to reference the study, for everyone has a certain reference value, the need for friends below to see it together.
there are generally simple and complex ways to replace variables with strings:
The simple approach is to put the variable name in a double-quote string or Heredoc:
$who = ' Kilroy '; $where = ' here '; echo "$who was $where"; Kilroy is here
The
PHP bit operations are not commonly used in PHP, but the role is quite large, let us introduce the PHP bit operation usage.
$a & $b and (bitwise AND)
$a | $b or (bitwise OR)
$a ^ $b Xor (Bitwise XOR)
~ $a not (bitwise non)
$a
$
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