PHP mb_substr Implementation of Chinese string interception without garbled method

Note: Find php.ini in Windows directory Open edit, search Mbstring.dll, findExtension=php_mbstring.dll the front of the number, so the MB_SUBSTR function can be effective Example The code is as follows Copy Code $str = '

How to create a database and datasheet in PHP

$CN = MySQL tutorial _connect (' localhost ', ' root ', ');mysql_select_db (' Test ', $CN);Creating a Databasemysql_query ("Create datebase ' test ';");Creating data Tables$sql = "CREATE TABLE IF not EXISTS ' test ' (' ID ' int (8) not NULL

PHP Entry User Login instance code and tutorial

md5

First step /*First create the data table directly copy to your phpMyAdmin directly run on OK. 1 CREATE TABLE IF not EXISTS ' useradmin ' (' ID ' int (4) not NULL auto_increment,' username ' varchar default NULL,' userpass ' varchar default NULL,'

PHP Web Development Detailed: Search page design

PHP's search for a database is done primarily by using like clauses in SQL statements. If you search multiple keywords at the same time, you can use the Union clause to combine the search results. The following code implements a search

PHP super function, Chinese pinyin

$d =array ( Array ("A",-20319), Array ("AI",-20317), Array ("an",-20304), Array ("Ang",-20295), Array ("AO",-20292), Array ("BA",-20283), Array ("Bai",-20265), Array ("Ban",-20257), Array ("Bang",-20242), Array ("Bao",-20230), Array

An array problem with PHP

ini

Recently in doing a project, I found that in PHP, if you want to assign a value to an element of a data, you will get an error: ? PHP $str = " 222222 " ; $var = Array (A => " 1 " , b => $str , C => "" ); if ( $var [b]) { $var [C] = $var [b];} ?>  

PHP generates a simple example of a static page

A simple example:News template file news_tmp.html:{title}{news_title}{news_image} {news_content}______________________________________________________________________________________________Answer 7:News Generation file aaa.php:?Let's say the

Introduction to a simple mailbox sending component in PHP

The code is as follows Copy Code Include (' class/class.phpmailer.php '); $config = Array (' Host ' => ' smtp.163.com ',' Port ' => ' 25 ',' User ' => ' * * *,' passwd ' => ' * * * *,' From ' => ' juva_zz@163.com ',' FromName ' => '

Example of PHP using Preg_replace to replace HTML code

Example Comment on the expression using the label 1 to 60. The corresponding picture path/public/images/face/1.gif to/public/images/face/60.gif. The implementation method is to use the Preg_replace function to complete the display of the comment

The simplest tutorial on string matching algorithms in PHP

This article illustrates the simplest method of string matching in PHP, which is implemented as follows: The code is as follows Copy Code /*The simplest string matching algorithm PHP implementation methodT:ababcabcP:abc0.1

Php generate small figure _ php generate thumbnail code

# Display graphics and connectionsFunction showdir ($ adirectory, $ I){ Global $ browsedir;$ Start = $ I;# Changing $ maxcols and $ maximages can change the number of rows and columns of the small graph displayed on each page.$ Maxcols = 2;$

Php verification code program

The code is as follows:Copy code Session_start ();$ Im = imagecreatetruecolor (100,30 );// Assign color$ Bg = imagecolorallocate ($ im, 0, 0 );$ Textcolor = imagecolorallocate ($ im, 255,255,255 );// Mark the imageFor ($ I = 0; $ I $ Te1 =

Php image creation tutorial

$ Height = 300;$ Width = 300;$ Im = ImageCreateTrueColor ($ width, $ height );$ White = ImageColorAllocate ($ im, 255,255,255 );$ Blue = ImageColorAllocate ($ im, 0, 0, 64 );ImageFill ($ im, 0, 0, $ blue );// ImageLine ($ im, 0, 0, $ width, $ height,

Php verification code generation program

Php verification code generation program$ Consts = 'bcdfghjkmnpqrstwxyz ';$ Vowels = 'aei23456789 ';For ($ x = 0; $ x  {$ Const [$ x] = substr ($ consts, mt_rand (0, strlen ($ consts)-1), 1 );$ Vow [$ x] = substr ($ vowels, mt_rand (0, strlen ($

PHP functions used to determine the IP format

Function is_ip ($ str ){If (! Strcmp (long2ip (sprintf ("% u", ip2long ($ ip), $ ip) return 1;Else return 0;}Or (used in earlier versions)Function is_ip ($ str ){$ Ip = explode (".", $ str );If (count ($ ip) 4) return 0;Foreach ($ ip as $ ip_addr ){

Use PHP to send email 2

The mail () function is very simple: there are only five parameters, and two of them are optional. These parameters are:Recipient addressTopicLetter contentOther file information headers (optional)Other configuration options of the SMTP Service

PHP converts scientific notation to the original numeric string

The code is as follows:Copy code Function NumToStr ($ num ){If (stripos ($ num, 'E') == false) return $ num;$ Num = trim (preg_replace ('/[= \' "]/','', $ num, 1),' "'); // Scientific notation is displayed, returns a string.$ Result = "";While ($

Php checks whether the data is a json character

Remember that json_encode returns a string, while json_decode returns an object.Determine that the data is not in JSON format: The code is as follows:Copy code Function is_not_json ($ str ){Return is_null (json_decode ($ str ));} Determine that

Use curl in php to obtain the cookie of the returned page

Curl can obtain the cookie Set on the returned page. The principle is the same as that of get_headers. You can retrieve the "Set-Cookie:" Content from the returned header.Test page/cookie setting page:Test. php The code is as follows:Copy code

11 common mistakes made by PHP programmers

1. Use myisam instead of innodbThe mysql tutorial has many database tutorial engines, but the most common examples are myisam and innodb.Mysql uses myisam by default. However, in many cases this is a bad choice unless you are creating a very simple

Total Pages: 12780 1 .... 12571 12572 12573 12574 12575 .... 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.