Select SQL statement, as far as possible, as little as possible to insert, update operation (on the update, I was a bad batch);
42, as far as possible the use of PHP internal functions (but I have to find a php non-existent function, wasted can write a custom function of time, experience problem ah!);
43, the loop inside do not declare variables, especially large variables: objects (this does not seem to
measures in PHP code that processes forms. Similarly, even if PHP RegEx is used to ensure that the get variable is completely numeric, you can still take measures to ensure that the SQL query uses escape user input. Defense in depth is not just a good idea. It ensures that you are not in serious trouble. Now that we have discussed the basic rules, we will study
notation is hard to remember, and we have to check the documentation almost every time we use it. But starting with the version of Laravel 5.3.18 These two validation rules can be simplified by a new rule class.
We can now use the familiar chained syntax below to achieve the same effect:
' Email ' = [' Required ', rule::exists (' staff ')->where (function ($query) {$query->where (' account_id ', 1);}),] ,
' Email ' = [' Required ', Rule::unique ('
: This article mainly introduces the common rules of [PHP] Yiirules. if you are interested in the PHP Tutorial, refer to it.
Public function rules () {return array (// you must enter array ('email, username, password, agree, verifyPassword, verifycode', 'required '), // check whether the username is repeated array ('em
function Get_area ();Unlike the general method, this method does not have curly bracesYou cannot create an instance of this abstract class: $Shape _rect= new Shape ();}Class Rectangle extends shape{Private $width;Private $height;function __construct ($width = 0,$height =0) {$this->width= $width;$this->height= $height;}function Get_area () {Echo ($this->width+ $this->height) * *;}}$Shape _rect = new Rectangle (20,30);$Shape _rect->get_area ();?>This is a simple example, basically can explain the
like?
Listing 4. Easy Code Protection
<?PHP //obfuscated code$input = (isset($_POST['username']) ? $_POST['username']:'');//unobfuscated code$input = '';if (isset($_POST['username'])){ $input = $_POST['username'];}else{ $input = '';}?>
In the second clear code segment, it is easy to see that $ input is defective and needs to be cleaned up before it can be processed safely.
Rule 4: "defense in depth" is a new magic weapon
This tut
Regular Expression Matching Rules for PHP core technologies and best practices
Regular Expression Matching Rules for PHP core technologies and best practices
This article describes several common matching rules.
1. Character Group
It is easy to search for numbers, letter
Regular expression matching rules for PHP core technology and best practicesThis article describes several common matching rules.1. Character groupsFinding numbers, letters, and blanks is simple because you already have metacharacters that correspond to these collections, but if you match a character set that doesn't have predefined metacharacters, it's simple to
Yii is a component-based high-performance PHP framework for developing large Web applications. Yii is written in strict OOP and has a complete library reference and comprehensive tutorials. This article will introduce you to the phpyii Framework's form verification rules, if you are interested, learn it together. Yii is a component-based high-performance PHP fram
Here we will provide a detailed explanation of PHP syntax rules, hoping to help php programming develop to a higher level. 1. simple syntax rules (variable names are defined using curly brackets, applicable to all PHP versions ):
The code is as follows:
$ A = 'flower ';
Ec
Here we will provide a detailed explanation of PHP syntax rules, hoping to help php programming develop to a higher level. 1. simple syntax rules (variable names are defined using curly brackets, applicable to all PHP versions ):
The code is as follows:
$ A = 'flower ';Ec
: AllowOverride All
II. Rewrite statement:
We cannot modify the configuration file on the server. In most cases, we need to create a. htaccess file under the root directory of the website. The code is as follows:
RewriteEngine on // start the rewrite engine RewriteRule ^/index ([0-9] * pai.html $/index. php? Id = $1 // "([0-9] *)" indicates that the range (. *) indicates all, the same below. RewriteRule ^/i
PHP template engine Smarty Detailed description
This article mainly introduces the PHP template engine Smarty Detailed introduction, this article explains what is smarty, smarty advantages, not suitable for use Smarty Place, Smarty directory structure and version, the need for friends can refer to the next
/*
First
1. Simple syntax rules (use curly braces to define variable names for all versions of PHP):
Copy CodeThe code is as follows:
$a = ' flower ';
echo "She received some $as";//invalid; the letter S will be considered as a valid variable name, but the variable here is $ A
echo "She received some ${a}s";//Valid
echo "She received some {$a}s";//valid; Recommended Use method
What we want to express is "she rece
Transfer from http://www.cnblogs.com/jayleke/archive/2011/11/08/2241609.html1. Simple syntax rules (use curly braces to define variable names for all versions of PHP): $a = ' flower '; echo "She received some $as"; The letter S will be considered as a valid variable name, but here the variable is a $ A echo "She received some ${a}s"; Effective echo "She received some {$a}s"; Effective; Recommended use metho
Parse CI: the rewrite rules of the CodeIgniter framework under Nginx. I recently studied the CI framework and found that the routing function of this framework is faulty under Nginx and reported a 404 error. later I checked the information online and found that PATH_INFO needs to be enabled. After nginx7.16, it seems that the CI framework has been supported recently. I found that the routing function of this framework is faulty under Nginx and reporte
PHP naming rules
The framework written in PHP must have its own specifications, and ThinkPHP also has some specifications. The following naming rules should be followed if ThinkPHP is used:
2. All class files are. class. php is a suffix (this refers to the class library file
Yii is a high-performance, component-based PHP framework for developing large Web applications. Yii is written in strict OOP, with well-established library references and comprehensive tutorials.
Not much nonsense to say, directly to everyone put the code.
Complete Example:
Public $password 2;//fields for non-databases, but public $verify are required in view; Phone verification Code Public $FJG; Forgot number/** * Map database table name * @return
1. Simple syntax rules (use curly braces to define variable names for all versions of PHP):=' flower ';" She received some $as "; The letter S will be considered as a valid variable name, but here the variable is $ A"She received some ${a}s"; Effective "She received some {$a}s"; The recommended way to use What we want to express is "she received some flowers", the context of the flower should be
PHP namespace parsing rules
namespace name definition
Unqualified names unqualified Name
名称中不包含命名空间分隔符的标识符,例如Foo
Qualified name qualified name
名称中含有命名空间分隔符的标识符,例如:Foo\Bar
Fully qualified name fully qualified name
名称中包含命名空间分隔符,并以命名空间分隔符开始的标识符,例如:\Foo\Bar.namespace\Foo 也是一个完全限定名称。
Name resolution follows these rules
Calls to fully qualified names for functio
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.