The CI security class provides a global defense against CSRF attacks and XSS attack policies that require only the configuration file to be opened:
Copy Code code as follows:
$config [' csrf_protection '] = TRUE;
$config [' global_
A problem is encountered today in learning the CI framework:
A PHP Error was encountered
Severity:notice
message:undefined Variable:user
Generally in the default normal php file output an undefined declaration of a variable is not reported wrong,
The site needs to add a new constant, open the local config.php file, think about the hidef that was tested a few years ago and the APC upgrade define performance.My program has a different configuration for development, testing, production servers,
For an experienced PHP Web developer, this is a very easy thing to do. But for beginners who just started to touch the PHP programming language, this is a problem. So here's how to embed PHP code in regular HTML code.
Embed PHP code in regular HTML
1, Super simple page Caching
If your project is not based on a CMS system or framework, creating a simple caching system will be very real. The following code is simple, but it can solve the problem for small web sites.
Copy Code code as
1. Use a SQL injection memoA basic principle is that you should never trust the data the user submits.
Another rule is to escape (escape) when you send or store data.
Can be summed up as: Filter input, Escape output (FIEO). Input filter, output
The example in this article describes how PHP realizes the conversion of Arabic and Roman numerals to each other. Share to everyone for your reference. as follows:
3999 | |
$f 1000, ' D ' =>, ' C ' =>, ' L ' =>, ' X ' =
>, ' V ' => 5, ' I '
This example describes the way PHP converts date formats to XX days. Share to everyone for your reference. Specifically as follows:
This code can format the time 3 days ago, 5 seconds ago, 2 years ago.
Convert a date into a string "tells how
This article illustrates a simple way to implement a multi-byte string flip in PHP. Share to everyone for your reference. The implementation methods are as follows:
0) {
$reversed. = mb_substring ($string, $length, 1, $encoding);
return
The role of data encryption in our lives has become increasingly important, especially given the large number of transactions and data transmissions that occur on the web. For information that does not need to be restored to the original data, we
This article illustrates how PHP saves pictures as different sizes of picture classes. Share to everyone for your reference. Specifically as follows:
Picture processing class. Imagecls.php is as follows:
$this->max_size) | |
( -1 = = $this->
This article illustrates the method of randomly generating credit card number in PHP. Share to everyone for your reference. The specific analysis is as follows:
This PHP code generated according to the credit card card number generated rules
This article describes the micro-credit platform mobile application integrated micro-credit payment function. Share to everyone for your reference. The specific analysis is as follows:
The Wechatapppay file code is as follows:
Copy Code code
This article describes the PHP ban on an IP or IP address section of the method of access to share for everyone to reference. The specific analysis is as follows:
Because I haven't studied Apache and Nginx, I've written a small program that can
Solutions under Windows:
Check to see if the directory exists or if the directory has write permissions for everyone or authenticated users by looking for a path to PHP.ini's Session.save_path = "". It's generally okay.
Solutions for
This example describes how PHP gets the start and end dates for each week of the year. Share to everyone for your reference. The specific analysis is as follows:
Recent projects need to do a weekly reporting function, you need to know the start
One, no matter what the program, function name () {}, for () {}, .... Too much, do not say also know what to do with.
Two, $str {4} After the string's variable followed by {} braces and brackets are all treating a string variable as an array.
Three,
Notice:use of undefined constant all_ps-assumed ' all_ps ' in E:\Server\vhosts\www.lvtao.net\global.php on line 50
notice:undefined Index:easetemplatever in E:\Server\vhosts\www.lvtao.net\libs\template.core.php on line 51
Notice:use of undefined
The example in this article describes how PHP gets file MIME types. Share to everyone for your reference. Specifically as follows:
1. Using the Mime_content_type method
String Mime_content_type (String $filename)
Returns the MIME
Assignment and replication of objects: assignment: Overloading by the "=" operator
User A (a), B;
b = A;
Replication: Calling a copy constructor
User b;
User A (b);
Or
User A = b;//is equivalent to User A (b);
Unlike assignment, the assignment is to
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