PHP adds the watermark function for image uploading and proportional scaling.

You can add the watermark function by yourself:Copy codeThe Code is as follows:/**** @ Author zhao jinhan* @ Date January 13, 2014 11:54:30* @ Email xb_zjh@126.com**/Header ('content-type: text/html; charset = UTF-8 ');// Define the width and height

Memcache command startup parameters

Copy codeThe Code is as follows:Usr/local/bin/memcached-d-m 128-u root-l 192.168.0.10-p 12121-c 256-P/tmp/memcached. pid -TCP port listened by p (default: 11211)-U udp listening port (default: 11211, disabled when 0)-D run as a daemon-U: the

The filter function in php verifies and filters user input data.

Introduction to PHP FilterPHP filters are used to verify and filter data from unsafe sources (such as user input.Copy codeThe Code is as follows:// Remove html tags or encode special charactersVar_dump (filter_var (" Chinese ABC @ # BBB ",

Php prevents SQL injection sample analysis and regular expressions for several common attacks

Injection Vulnerability code and Analysis Copy codeThe Code is as follows:Function customError ($ errno, $ errstr, $ errfile, $ errline){Echo " Error number: [$ errno], error on line $ errline in $ errfile ";Die ();}Set_error_handler ("customError"

Example of php curl simulating post requests

1. Local Machine: $ Uri = "http://www.jbxue.com/test.php"; // address of your server here// Parameter Array$ Data = array ('Name' => 'tanteng'// 'Password' => 'Password'); $ Ch = curl_init ();// Print_r ($ ch );Curl_setopt ($ ch, CURLOPT_URL, $

Regular Expressions used by php to prevent SQL injection vulnerability code & amp; against several common attacks

Injection Vulnerability code and Analysis Code firstCustomError (, " Error number: [], error on line in " ("customError ", = "'| (and | or) \ B. +? (>||| operation IP Address :". ["REMOTE_ADDR"]. " operation time :". ("% Y-% m-% d % H: % M: % S ").

How to generate Baidu Site Map

Copy codeThe Code is as follows:Function sitemapxml (){$ User = M ('sethouse'); // thinkphp Data Link$ Today = date ("Y-m-d", time ());$ Yesterday = mktime (0, 0, 0, date ("m"), date ("d")-1, date ("Y "));$ Lastweek = strtotime ("-1 week ");$ Link =

Php Data Type Conversion

PHP does not need (or does not support) Explicit Type Definitions in variable definitions. variable types are determined by the context in which the variable is used. That is to say, if a string value is assigned to the variableVar,VarIt becomes a

Php retrieves keywords from Baidu search to enter the website

Code: Function search_word_from (){$ Referer = isset ($ _ SERVER ['HTTP _ referer'])? $ _ SERVER ['HTTP _ referer']: '';If (strstr ($ referer, 'Baidu. com') {// baiduPreg_match ("| baidu. + wo? R? D = ([^ \ &] *) | is ", $ referer, $ tmp );$ Keyword

Js cookie to prevent multiple submission in a short time

Use Js cookies to prevent defaultTime = 10000 for multiple comments in a short period of time; // The default interval is 10 seconds; Use Js cookies to prevent multiple comments in a short time.

Analysis on the principle of dragging on a JavaScript page

The basic principle of drag is to move the dragged element based on the movement of the mouse. The movement of the mouse is the change of x and y coordinates. The movement of elements is the change of top and left of style. position. Of course,

Several mysql statements commonly used in PHP

Several mysql statements commonly used in PHP show database or table: change table name: add column: delete column: create and change column information: Index: Show database or table: Show databases; // You can then use database_name; Show

Php Webservice communication

WebService is a new web application branch. it is a self-contained, self-describing, and modular application that can be released, located, and called through the web. WebService can execute any function from simple requests to complex business

PHP Cache technology

The WEB program obtains information mainly by querying the database. when the database is not very large, there will be no major problems. however, with the development of the website, when the database grows in a geometric level, there will be

PHP uses the mysql database to store session code

Most php users use cookies once they apply them to the session. Although cookies are good, they also bring us some hidden risks. Risk 1: if the cookie on the client machine fails due to a virus, the session will be lost. Most php users use cookies

PHP simple collector creation

A collector, also known as a thief program, is mainly used to capture others' webpage content. It is not difficult to create a collector, that is, to remotely open the webpage to be collected, and then use a regular expression to match the required

Install and use the phpXdebug debugging extension.

When downloading the xdebug extension, pay attention to the correspondence between the xdebug version and the php version, otherwise there will be unnecessary trouble! When installing and downloading Xdebug extensions in xdebug, pay attention to the

PHP obtains the last update time of remote files.

Content-Length is the file size. Therefore, you can obtain the file size echostrtotime ($ headInf ['last-modified']) from the file header. // output the Last UNIX timestamp. $ Url = 'http: // www.js4j.com/index.html ';$ HeadInf = get_headers ($

PHP Tutorial: strlen and mb_strlen string length functions

All PHP users know that strlen and mb_strlen are functions used to evaluate the string length. However, for some beginners, if they do not read the manual, they may not know the difference. All PHP users know that strlen and mb_strlen are functions

Php obtains the first letter of the Chinese character string.

I have previously created a page for getting the first letter of the keyword pinyin. below I will post the code for php to get the first letter of the string Pinyin: I have previously created a page for getting the first letter of the keyword pinyin.

Total Pages: 12780 1 .... 11937 11938 11939 11940 11941 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.