PHP_MySQL tutorial-basic functions on page 1 on the third day
Welcome to the third and last course of this tutorial. If you have learned the first and second lessons, you have mastered the basic installation and programming knowledge of MySQL and
Php code converts a full-width number to a half-width number // converts a full-width number to a half-width number.
Function GetAlabNum ($ fnum ){
$ Nums = array ('0', '1', '2', '3', '4', '5', '6', '7 ', '8', '9 ','. ','-',' + ',':');
$ Fnums =
[PHP] a collection of frequently used practical functions is about to learn php. I found that many functions need to be used and can be written by myself, so I found common php functions, from various major php systems, php practical functions are
Replace the phpsession class with the mysql memory table. you can test the effect on your own.
The code is as follows:
/**@ Usage: use some other storage method (mysql or memcache) instead of php sessoin@ Author: lein@ Version:
PHP is a programming language that is easy to use, easy to learn, and widely available. It is ideal for developing simple scripts that can be used in various games. Whether it's a simple, paper-and pen-based game, a group of people playing complex
All PHP file packages remove all comments in one PHP file remove extra spaces keep output pure PHP (that is, no additional processing steps are required to parse the file) usage: (run on the command line)
The code is as follows:
Php compactor. php
The first time I used the template smarttemplate, it was much smaller than smarty, but it was inconvenient. Smarty can directly encode the url, such
But it does not seem to have been found in smarttemplate. because the link is submitted by js,
Use single quotes instead of double quotes to include strings, which is faster. Because PHP will search for variables in strings enclosed by double quotes, but not in single quotes. Note: Only echo can do this, it is a "function" that can treat
Because the id in the database may be large. If % d is used, the correct result may not be returned because it is out of the range. Therefore, it is recommended that %. 0f be better than % d when formatting the id. Compare to construct SQL
The XML support is enhanced in PHP5, and the XML operation capability is extended using DOM. These functions are part of the PHP5 core and can be used without installation. The following example demonstrates DOM operations on XML. For more
Mayfish can flexibly customize validation rules for the data content to be written to reduce the trouble for developers to manually verify the data of each field. Before writing data to the database, you should first verify the data to be written to
For friends who are learning php, they started to make a message board and had a simple process for php + mysql operations. I learned this and started to get started with php.
Config. php
The code is as follows:
$ Conn = @ mysql_connect
In Joomla, you can use configuration. php to store simple data code. For more information, see.
Write process
The code is as follows:
// Get the path of the configuration file$ Fname = JPATH_CONFIGURATION.DS. 'configuration. php ';// Clear
Summary of several methods for opening URL addresses in PHP. the functions here are mainly used for functions such as thief collection.
1: get content using file_get_contents in get mode
The code is as follows:
$ Url = 'http: // www.baidu.com /
PHP mandatory file download function code. this function provides mandatory file download functions for users.
The code is as follows:
/********************* @ File-path to file*/Function force_download ($ file){If (isset ($ file) &
Suppose we want to test. when operating the VM database in the PHP file, you must first debug it locally. Therefore, you must connect to two different databases locally and remotely. question: how to make test. does php automatically identify
Image processing: the implementation of watermarking and thumbnails (custom functions: watermark and thumbnail) code is a bit long, but not complex. Don't talk nonsense. paste the code:
The code is as follows:
/**********************************
Javascript and php code for getting function parameter objects. For more information, see. For example:
The code is as follows:
Function say (){Alert (arguments [0] + ':' + arguments [1]);}Say ('hanglor ', 'hanglor is a boy! ');
Result:
If you want to break through anti-Leech measures, you need to consider using HTTP_REFERER. Many websites use referer to determine whether to steal links. If you want to take measures to break through the anti-Leech protection, you need to consider
Php uses foreach to operate the array code. For more information, see. Foreach () has two usage methods:
The code is as follows:
Foreach (array_name as $ value){Statement;}
Here, array_name is the name of the array to be traversed. in each loop,
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