PHP variable naming rules
1. The variable begins with the dollar sign $. such as $name, $age.
2, dollar sign $ The first character that follows cannot be a number, only an underscore _ or a letter. Variables such as $1_1 are wrong.
3, in addition to the underscore _, the variable does not allow any space or punctuation. This means that the variable name can only contain: A-Z, A-Z, 0-9, and underscore _.
pre-checkSub-pattern matching:Output:Do not capture sub-patterns:Forward pre-check: Before matching, check whether the expression conforms to the rules in parentheses, non-capturing matchesOutput: Note this is ' P 'Forward mismatchOutput:Reverse Pre-check (? Reverse pre-check: Before matching, ensure that the preceding sub-mode conditions, that is, and sub-mode matching.Run:Reverse mismatch:Run:Greedy mode.*? The regular
Beginners PHP, you may encounter the PHP naming problem, here will introduce the PHP naming rules, hope can help everyone, careful friends can write down to stay as a future study material.
1. Proper naming of PHP naming rules
Na
PHP template engine: TinyButStrong3.6.0 released. TinyButStrong (TBS) is a PHP template engine that separates PHP scripts from HTML files. TBS is designed to use any visual HTML editor to compile tbs html template pages. This version of TinyButStrong (TBS) is a
The template engine (specifically the template engine used for Web development) is generated to separate the user interface from the business data (content). it can generate documents in a specific format, the template engine for websites generates a standard HTML document. The PHP template
ThinkPHP uses the Rewrite rules of the. htaccess file to hide index. php in the URL and remove index. php from the URL.
ThinkPHP, as a PHP framework, is a single portal, so its original URL is not so friendly. However
ThinkPHP provides various mechanisms to customize the desired URL format. in combination with the Apa
decide how to protect it.
For example, which of the following two sections of code do you like?
Listing 4. Easy Code Protection
Reference content is as follows:
// 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.
Ru
Remove index. php from the URL
Thinkphp, as a PHP framework, is a single portal, so its original URL is not so friendly. However, thinkphp provides various mechanisms to customize the desired URL format. In combination with the Apache. htaccess file, thinkphp can also customize a user-friendly and Seo-friendly URL address.
The. htaccess file is a configuration file on the Apache server. It is responsible fo
/configs/application. ini in the configuration file:
phpSettings.display_startup_errors = 1phpSettings.display_errors = 1resources.frontController.params.displayExceptions = 1
Next, let's briefly talk about the model in zend:
1. Default Model
A standard webapp contains a directory such as application/models. It is easy to see that models is used to store the model of your app
The strength of this directory is that if you define a specific class in the models directory. Zend will automatically
PHP is a language that runs on the server side and can dynamically generate HTML pages. This blog describes some of its coding rules.I. BASIC RULES1, PHP code always use 2, each PHP statement to end with a semicolon (;);3, if there is PHP code in the Web page, it is best to name the file name extension on the Web serve
'))? $_post[' username ']: ");unobfuscated Code$input = ";if (isset ($_post[' username ')) {$input = $_post[' username ');}else{$input = ";}[/php]In the second, clearer code snippet, it is easy to see that $input is flawed and needs to be cleaned before it can be handled safely.Rule 4: "Defense in Depth" is a new magic weaponThis tutorial will use an example to illustrate how to protect an online form while taking the necessary steps in the
PHP yii framework of form validation rules Daquan, YII framework
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;//fi
PHPYii framework-a list of form verification rules, yii Framework. PHPYii framework is a complete list of form verification rules. yii Framework Yii is a component-based high-performance PHP framework for developing large Web applications. Yii adopts strict OOP writing and has a complete library of PHP Yii Framework fo
This article mainly introduces how to use the configuration file of the PHP template engine Smarty in the template variables, and analyzes the procedure and related skills of using the configuration file variables in the form of instances, for more information about how to use the configuration file of the PHP template engine
have discussed the basic rules, we will study the first threat: SQL injection attacks.
◆ Prevent SQL injection attacks
In SQL injection attacks, you can manipulate the form or GET query string to add information to the database query. For example, assume there is a simple login database. Each record in this database has a username field and a password field. Create a logon form to allow users to log on.
Login
Username
P
{
$ 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 tutorial uses examples to illustrate how to protect online forms and take necessary measures in PHP code that processes forms. Similarly, even if PHP regex is used to ensure that the GET variabl
This article mainly introduces the usage of the PHP template engine Smarty custom variable mediation, and analyzes in detail the usage of the smarty variable regulator and the implementation skills of the custom variable regulator, for more information about the usage of the PHP template engine Smarty custom variable m
: This article mainly introduces the PHP namespace parsing rules. if you are interested in the PHP Tutorial, refer to it. PHP namespace parsing rules
Namespace name definition
Unqualified name
The name does not contain the namespace separator identifier, such as Foo.
Qualif
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 the first threat: SQL injection attacks.
◆ Prevent SQL injection attacks
In SQL injection attacks, you can manipulate the form or GET query string to add information to the database query. For example, assume there i
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.