PHP intercepts strings in English. It is easy to use substr directly. Generally, no garbled characters are displayed. It is a little troublesome to use Chinese characters.Two solutions are provided below:(1) directly use the mb_substr () of the
2.4. XSS attacks
Cross-site Scripting is one of the well-known attack methods. Web applications on all platforms are deeply affected, and PHP applications are no exception.
All Input Applications face risks. Webmail, forums, message books, and
Introduction: This is a detailed page of the PHP website and PHP manual. It introduces the knowledge, skills, experience, and some PHP Source Code related to PhP, PHP, Web PHP, and PHP manual.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: //
Introduction: This is a detailed page for PHP database support options. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 3
Note: For example, $ STR = "this is a book! "; $ STR [0] or $ STR {0} indicates" T ", and so on.
// Remove spaces and other symbols1. String trim (string STR [, string charlist]): Remove spaces or other characters on both sides2. String ltrim
Introduction: This is a detailed page for PHP tokenizer study notes. It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 323132
Php prevents repeated forms from submitting instances:
Copy codeThe Code is as follows: Session_start ();
$ _ SESSION ['fsess'] = ($ _ SESSION ['fsess'])? $ _ SESSION ['fsess']: time ();
?>
prevent repeated submission of forms
Javascript and
$ Root = getenv ('document _ root'); // the ROOT directory of the server DOCUMENT
$ Port = getenv ('server _ port'); // SERVER PORT
$ File = getenv ('script _ name'); // The current execution file
$ Ua = getenv ('HTTP _ USER_AGENT '); // user UA
$
Copy codeThe Code is as follows:
// The search is not done yet. The data is displayed, but it cannot be displayed.
Index. php fileCopy codeThe Code is as follows: Header ("Content: text/html; charset = UTF-8 ");$ Link = mysql_connect
Header ()Is used to send raw HTTPHeaders. See the HTTP/1.1 specification for more information on HTTPHeaders.
Example 1:Copy codeThe Code is as follows: Header ("Location: http://www.jb51.net ";);Exit; // after each redirection, you must add "exit"
PHP developers all know that the most worrying thing is that there are some exceptions or errors in the program. If these conditions are output to the user's screen, the user will be frightened and even lost their work, if it is not output to the
When the gd library of php is enabled on windows Server, gd is not displayed in the Configure Command in the result obtained by phpinfo () after cgi is used.
Displayed after Configure CommandYes:Copy codeThe Code is as follows: 1 cscript/nologo
The unlink () function deletes files, the mkdir () function creates directories, and the rmdir () function deletes directories.
Copy codeThe Code is as follows:
unlink () function instance
// Use the unlink function to delete an object
$
Copy codeThe Code is as follows: // The following code will draw a very beautiful leaf
// Define the point of view of PI
Define ("PII", M_PI/180 );
// Create an image resource and set the background to white. The foreground color to black.
$ Im =
Which of the following functions is used to define a top-level exception processor?
Set_exception_handler ("My_exception ");
Here, My_expection is a developer-defined exception handling function, which is a top-level exception processor. Only when
Example:
Copy codeThe Code is as follows: $ A = fopen('test.txt ', 'R ');
// The file is opened without judgment. If the file does not exist, an error is returned.
?>
The correct statement should be as follows:Copy codeThe Code is as follows:
PHP design mode factory mode usage
Copy codeThe Code is as follows: /*
* Daily practice of using the PHP design mode factory Mode
* The PHP factory model is not hard to understand. As the name suggests, it is a processing factory, and then the
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