The code is as follows
Copy Code
? PhpRequire_once ("mssql.class.php");1. Create a class and connect to a database$DB = new MSSQL ("Dns=aaa;uid=sa;pwd=sa;dbname=test");2. Connecting to the database$conn = $db->config
The following one is to determine whether the domain name entered is legal, and then the http,https,ftp for processing, analysis and send
function _scan_url (){$req = $this->_url;$pos = Strpos ($req, '://');$this->_protocol = Strtolower (substr
First, Introduction PHP, a web design scripting language that has sprung up in recent years, because of its strong and scalable, in recent years has been a significant development, compared to traditional PHP ASP Web site, in the speed has an
Advanced application of advanced application of for /*** Print necessary instructions*/Print (" how many days are there from Monday? ");Print (" ");For ($ currentDate = date ("U"); // defines the $ currentDate time formatDate ("l", $ currentDate )!
Php implements an infinitely hierarchical tree to Implement Level 2 capabilities in the main menu. You can also obtain sub-comments under the parent comment when developing a message board! This is the function to implement an infinite tree! We will
Example 1 The code is as follows:Copy code Function isValidUrl ($ url ){ $ Patern = '/^ http [s]? :\/\/'.'([0-9] {1, 3} \.) {3} [0-9] {1, 3}'. // URL in IP format-199.194.52.184'|'. // Allow IP and DOMAIN (DOMAIN name)'([0-9a-z _!~ * \ '()-] + \.
I like development best. Writing a program can improve your strength and add some code to your favorites! It is really good. For some reason, you need to obtain the maximum id of the database. So this section of php obtains the largest id code of
In PHP, the quickest way to read files is to use functions such as file and file_get_contents, A few simple lines of code can perfectly complete the functions we need. However, when the operated file is a relatively large file, these functions may
Public Environment front-endSend this file: Nginx + linux environment considerationsNotes for uploading large files in the php environment:/Usr/local/php/etc/php-fpm.conf.defaultRequest_terminate_timeout = 0 // This is the execution time of fastcgi,
Common php functionsStrstr (string, string) // truncate from the place where a string appears for the first time to the endStrrchr (string, string) // captures a string from its last position to its end.Strpos (string, string [, int]) // position
The index. php file is shown in the following figure. The code is as follows:Copy code Header ("Content-type: text/html; charset = GBK"); // output encoding to avoid Chinese garbled characters?> ajax paging demonstration $ Page = isset ($ _ GET [
Directly run the code:The following example shows how to delete the html of a specified directory. If you want other files, you only need to change the html to the suffix you want to delete. The code is as follows:Copy code $ Lanmu = array
This article mainly introduces two php string replacement functions: str_replace and substr_replace. The former is to replace needle in all haystace and return the result after replacement of haystace, the specific part of the string to be replaced
Class show_page {/*** Page output result ** @ Var string*/Var $ output;/*** If this class is used, the default value is PHP_SELF. ** @ Var string*/Var $ file;/*** Page number transfer variable. The default value is 'P' ** @ Var
Function validate ($ value, $ onoff = 0, $ type = 3, $ len = 100, $ msg = 'fill in error '){If (trim ($ value )! = "") {// If there is any contentIf (! Is_int ($ len ))Exit (" ");Preg_match_all ("/[xa0-xff]?. /", $ Value, $ arr); // mix Chinese and
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