PHP Read txt file Chinese garbled solution

1: If the page is open garbled, don't worry, do not do any editing. Remember。 2: Then click the menu to Modify-"page Properties-" title/Code 3: In the Code select Simplified Chinese (gb2321) 4: Click Reload-"Make sure to create a new Notepad (not WordPad!) , and then copy the file that you want to read into this Notepad file and save it. Use the following code to read the Notepad file 1303275.txt: found that when the page is encoded as gb2312 all normal display. Changed to UTF8 code, the number is normal ...

PHP rand () random function generation with number code

First, get to know the random number function rand () provided by the PHP tutorial. The rand () function of PHP returns a random integer using the following rand (Min,max) optional argument min and Max can cause rand () to return a pseudo random integer between 0 and Rand_max. For example, want a random number between 5 and 15 (including 5 and 15), with Rand (5, 15). Let me take a look at a specific example, we do a basic function call, do not set the specific parameters, we get the random number ...

PHP trim () Form validation is not an empty instance

PHP Tutorial trim () Form validation is not an empty instance, it should be an entry-level instance, telling you how to use the trim function to remove a space and then determine if the user is submitting data that is empty. <html> <body> <form method= "POST" action= "formerrorcheck.php" > <h1>contact informat ...

The PHP cookie records the Web page method that the user visited

Cookies are often used to identify users. Cookies are small files that the server leaves on the user's computer. Whenever the same computer requests a page through a browser, it sends cookies as well. Through the PHP tutorial, you can create and retrieve the value of a cookie. How do I create cookies? The Setcookie () function is used to set cookies. Note: the Setcookie () function must precede the <html> label. Syntax Setcookie (na ...

PHP analyzes phonetic functions from alphabetic strings

The following code implements a function that analyzes the phonetic characters within a string given a string, which is useful when analyzing the domain name as a double spell or three spelling.   The specific code is as follows: include (' data.php ');       function Ispinyin ($STR) {global $data; $str = Str_replace (Strstr (...)

How to output double quotes "with single quotes" in PHP

We all know that in PHP, double quotes and single quotes are strings, how do you output double quotes and single quotes? Let's take a look at the following example: First, let's look at several ways to output double quotes. * * $str = ' I want to output double quotes '; Echo $str; /* The result is: I want to output double quotes "Method Two */$str =" Output double quotes ""; Echo $str; Results output ...

PHP Gets the location code via IP

How to obtain the geographic location after using PHP to obtain the IP address, look down the following code: function Get_ip_place () {$ip =file_get_contents ("http://fw.qq.com/ipaddress");  $ip =str_replace (' ",", $IP); .

Filter all HTML tag properties in PHP

1, filter the regular expression of all HTML tags: </? [^>]+> executes, a regular expression that filters the properties of all HTML tags: $html = preg_replace ("/< ([a-za-z]+) [^>]*>/", "<\1>", $html); &n ...

PHP Access count code using cookies

This code is a statistic of the number of accesses that are implemented using cookies. <?php Global $count; $count = 1; if (!isset ($_cookie["Visittime"])) {Setcookie ("Visittime", Date ("y-m-d h:i:s")), Setcookie ("Visitcou ...

Find out if a file contains a specific string in PHP

There's a whole bunch of files. How do we find what we need, and the way to do that is to find the corresponding directory. Open the directory. Traverse all files. Each file is scanned again if it contains a display and does not continue looking until the end. Paging file (allfile.php) <div id= "Checkarea" > <h2>just Check it!</h2> <fo ...

Detailed PHP operation MySQL database

Operation database is the basis of dynamic Web programming, this article gives you a detailed description of how PHP operates MySQL database 1. Establish and close connection 1 mysql_connect () resource mysql_connect ([string hostname [:p ort][:/path/to/socket][,string username] [, String Passwor ...

PHP solve input input multiple spaces only show one problem

Here a simple introduction to the PHP solution input multiple spaces to display only one problem, we use the Chr (32) to replace the HTML characters, the need for friends can refer to. The code is as follows <body> <form id= "Form1" Name= "Form1" "method=" Post "action=" "> &nbs ...

Code to create a Web desktop shortcut with PHP or ASP

Create a new PHP document: The name is good to remember: shortcut.php PHP document content: Code code as follows: <?php $Shortcut = "[Internetshortcut] url=http://www.jzread.com/ idlist= [{000214a0-0000-0000-c000-000000000046}] prop3=19,2 ...

Several solutions to uft-8 Chinese code garbled in PHP and MySQL

For garbled this problem almost all of the PHP developers have encountered, we are mainly introduced below the PHP file garbled and page garbled and PHP MySQL database connection garbled solution. --PHP page UTF-8 encoding problem 1. In the code start out to add a line: The code follows header ("Content-type:text/html;charset=utf-8"); 2.PHP file Coding problem Click to edit ...

PHP to get all the pictures on the page address

This article analyzes and introduces a variety of use of regular extraction of the map in the picture, see all the following examples I can not preg_match_all this function, there is a need for friends to refer to. --code as follows copy code <?php//Get page All picture address function getimages ($str) {$match _str = "/(http://) + ([^ rn ...)

PHP Development of PHP paging program implementation Code

In Php+mysql to achieve a relatively simple pagination, as long as you get page and x each page a few records and then use the limit n,m can be the perfect implementation of pagination, this example is very clear to the needs of the students reference. The database Connection code code is as follows <?php $conn = @ mysql_connect ("localhost", "root", "" ...)

PHP Introduction to the Message Board program implementation code

The message board program needs to be implemented by PHP + database This tutorial is mainly about the PHP MySQL message system implementation process, including the addition of modified deletion and editing work, is a beginner to learn from PHP good data. Message Board of the SQL file, you can directly import to the MySQL code below create database form; Use form; CREATE TABLE ' message ' (' ID ' tinyint (1) NO ...

PHP number, character, object judgment function

In PHP, you can judge numbers, characters, objects, arrays, and so on, including those functions such as see Is_bool (), Is_int (), Is_integer (), Is_float (), Is_real (), Is_object (), and Is_array (). I don't know how much you know. --//double-precision is_double is_double-is_float () alias Description This function is an alias function of Is_float (). &n ...

PHP generates CAPTCHA pictures from getting started and proficient in tutorials

In PHP to generate a CAPTCHA image is quite simple, because in PHP for us to provide a graphics Gd.dll library, to enable the GD graphics library we just php.ini in the PHP-GD front; Method a $authnum = '; $ychar = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z&qu ...

Summary of several methods of PHP page pass parameter value

PHP is a server scripting language, and he is now the most popular web development language, the following we describe several of the PHP development applications commonly used in the four of different ways to pass parameters between the two. First: Use a cookie from the client browser. Cookies are easy to understand, is a temporary file, you can see it as a storage room, the browser in the process of browsing the record of some information, temporarily stored here.   Set a cookie in PAGE01. <?php &nb ...

Total Pages: 1204 1 .... 4 5 6 7 8 .... 1204 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.