1. Simple syntax rules (use curly braces to define variable names for all versions of PHP):
Copy Code code as follows:
$a = ' flower ';
echo "She received some $as";/invalid; the letter S is used as an element of a valid variable name, but the variable here is $a
echo "She received some ${a}s";/effective
echo "She received some {$a}s";/effective; recommended methods of use
we
, 'types' => 'zip, rar, xl S, pdf, ppt ', 'toolarge' => 'image cannot exceed 800k'), array ('url', 'file ', // The file type is 'allowempty '=> true, 'types' => 'jpg, png, gif, doc, docx, pdf, xls, xlsx, zip, rar, ppt, pptx, // The type of the file to be uploaded 'maxsize' => 1024*1024*10, // the size limit of the file to be uploaded. Note that it is not php. the Upload File Size in ini is 'toolarge' => 'the file size is greater than 10 MB. Upload Fai
; test// [Year] = gt; 2012// [Month] => 2// [Day] => 21// [FinalUrl] => news/read? Extra = 2012 status = 1 extraparam = test year = 2012 month = 2 day = 21//)// [Finished in 0.6 s]
// Access equivalent: http://www.test.com/news/read? Extra = 2012 status = 1 extraparam = test year = 2012 month = 2 day = 21
// Index. php is hidden during deployment and the apache rewrite module is enabled.// Rewrite rule: RewriteRule ^ (. +) $/index.
Php rewrite rules: www.baidu.com/2/baidu/p5
How to write such rewrite rules, that is,. HTACCESS, baidu is not a folder but also a parameter, p5 is a parameter,
# RewriteRule ^. *-([0-9] {1,}) \/baidu/p ([0-9] {1,}) $ index. php? What I wrote conflicts with other rewrite rules
Naming rules for php development
Class name
1. use uppercase letters as the word segmentation, and use lowercase letters for other letters
2. the first letter of the name should contain uppercase letters.
3. do not use the underscore "_"
Class attribute name
1. the attribute name should be prefixed with 'M'
2. the prefix 'M' adopts the same naming rules
Custom routing rules in the CI framework and custom routing in the ci framework. Custom routing rules in the CI framework. in the ci framework, a URL corresponds to the class in the controller and the method in the class, for example, www. custom routing rules in the t CI framework and custom routing in the ci framework
In the CI framework, a URL corresponds to
Always feel that the various casing rules in PHP is unclear, even the veteran who worked for many years may not be able to understand the size of the PHP-sensitive issues enough. In PHP, the handling of case sensitive issues is messy, we must pay attention to. Even if the case is not sensitive in some places, it is bes
This article analyzes the usage rules of arrays in PHP. Share to everyone for your reference. The specific analysis is as follows:
Arrays are in a very important position in PHP. strings, pictures, digital, and video equivalents are all in the form of arrays, so it is necessary to understand the various rules of the a
Smarty; // Create a Smarty object $smarty->assign ("name", "Zhangmiao"); // assign values for use in templates $smarty->assign ("Age", "the"); $smarty->display (' Index.tpl '); // introduce templates, show view pagesLet's look at the template source code like this: H1 > Test template 1H1> My name is: {$name}BR/ > My age is: {$age}br/>The browser page is like this:Question: We do not have PHP code in the template, we only use {$name} and {$age} to dis
expression to handle it. In this example, you only want to accept letters. It may also be a good idea to limit a string to a specific number of characters, or to require all letters to be lowercase.Listing 3. Make user input Secure$myUsername = cleanInput ($_post[' username '); clean!$arrayarrayUsers = Array ($myUsername, ' Tom ', ' Tommy '); clean!Define ("greeting", ' hello there '. $myUsername); clean!function CleanInput ($input) {$clean = Strtolower ($input);$clean = Preg_replace ("/[^a-z]/
name is recommended.
Function show () {echo "Hello World" ;}show (); // output Hello World Recommended syntax show (); // output Hello Worldclass cls {static function func () {echo "hello world" ;}} Cls: FunC (); // output hello world
2. Magic constants are case-insensitive and should be capitalized.Including: __line _, _ FILE _, _ DIR _, _ FUNCTION _, _ CLASS _, _ METHOD _, and _ NAMESPACE __.
Echo _ line __; // output 2 echo _ LINE __; // output 3
3. NULL, TRUE, and FALSE are case insensitive
Url redirection rule for help !!! Is sell_list.php redirected to sellsell_list.php? Is fid1 redirected to selllist? Fid1bencandy. php? Is the fid-55-id-21619-page-1.htm redirected to newsbencandy. php? Fid55 amp; id21619 ask for help. I wrote many url redirection rules for help !!!
/Sell_list.php redirects to/targets
/Sell_list.php? Fid = 1 redirect to/assets/
when the second commit, the second commit fails because the cookie already has a record of its submission.However, Cookie storage has a fatal weakness, and if a cookie is hijacked (an XSS attack can easily get a user cookie), then again Gameover. Hackers will directly implement CSRF attacks.[PHP]View PlainCopyprint?
/*
* PHP easy to use token to prevent the form of repeated submissions
* This pr
When learning development, we need to know some common sense. for example, variable naming rules are a very important habit, if you develop a good naming convention for variables, the team you work with will be more likely to accept
When learning development, we need to know some common sense. for example, variable naming rules are a very important habit, if you develop a good naming convention for variable
rules and the substitution rules? Help
PHP
SEO
Inner Chain
------Solution--------------------
You're so complicated, you don't need to be replaced by HTML tags.
Because the tag may have been given a specific meaning, such as a tag is a connection
Although you think it is very complicated, but there is another place not to consider (inside the tag):
Spring Fe
Three tips for enabling the PHP engine to run at full speed. As a popular Web programming language, the biggest advantage of PHP is speed. PHP is already doing very well in this regard, and you can hardly find a script programming language that is faster than it. However, if you are a popular Web programming language,
This article mainly introduces 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, what is Smarty?Smarty is a template php template engine
Php naming rules
Class NameOneTwo
Class Name
2. class library namingCurrently, namespaces are becoming more and more widely used to avoid class name conflicts between different vendors and group class libraries. When namespace is not used, to avoid class name conflicts, the general practice is to add a unique prefix before the class name, the two characters can be
The php template engine technology uses smarty for simple implementation. After tp, you also want to know how the template technology is implemented. therefore, to write a simple template class, you can simply read the template file- gt; replace the content of the template file- gt; save or static nbsp; tpl. class. php mainly parses the assign method to implemen
Php checks whether a visitor is a search engine spider's function code. For more information, see.
The code is as follows:
/**
* Determine whether it is a search engine spider
*
* @ Author Eddy
* @ Return bool
*/
Function isCrawler (){
$ Agent = strtolower ($ _ SERVER ['http _ USER_AGENT ']);
If (! Empty ($ agent )){
$ SpiderSite = array (
"TencentTraveler ",
"B
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.