Ajax+php detect if the article title exists codePHP codefunction Checktitle (){$title = Postget (' title ');if (empty ($title)){return false;}Else{$Db = new Db ();$row = $Db->query ("SELECT * FROM news where title = ' $title '");if ($Db->rows ($row))
How to use JSON. PHP5.2 began with the built-in JSON support. Of course, if lower than this version, then there are many PHP version of the implementation, just the next use on the OK. Now the main is to talk about PHP built-in support for JSON.
PHP directory recursive function-lists the files and directories
Used to fulfill my needs. The principle of the function is very simple, the main thing is to use a recursive call.function File_list ($path) {if ($handle = Opendir ($path)) {while
PHP Domain name forwarding program is I see from other places, through XML and PHP Exchange implementation, let's take a look at the source file.
1test.domain.comhttp://www.111cn.net/to>
index.php files.
/*Domain name pseudo jump schemeby
PHP Practical Instance capture Remote Web site picture Save to LocalFirst from the article to all the with the right to dig out. $message//article content
Regular (this is not yet)
$reg = "/]*src=" (http://(. +)/(. +). ( JPG|GIF|BMP|BNP)) "/isu";
$message//article content
Regular (this is not yet)
$reg = "/]*src=" (http://(. +)/(. +). ( JPG|GIF|BMP|BNP)) "/isu";
Store the IMG address in the $img _array variable
Preg_match_all ($reg, $message, $img _array, Preg_pattern_order);
Filter for
There is a dedicated command for getting form data in the php Tutorial. $ _ POST [] is the function. Below is a simple example.Echo 'hello, '. $ _ POST ['first _ name'].'! ';?> The output is the value of first_name from the form.A little more
I. Variable assignmentYou can assign values to variables after they are declared. There are two methods: value assignment and reference assignment.1. Value assignment$ Color = "red ";$ Sum = 12 + "15";/* $ sum = 27 */2. If you want two variables to
Super global variable $ globals in the php Tutorial: contains a reference variable that is valid globally for each current script. The key of the array is the name of the global variable. $ Globals array exists from php 3.$ _ Server: variables are
1. Set cookieIn the php Tutorial, use the setcookie function to set the cookie. Note that cookie is a part of the http header used to transmit information between the browser and the server. Therefore, the cookie function must be called before any
. If you can use file_get_contents to replace file, fopen, feof, fgets, and other methods, use file_get_contents as much as possible because of its high efficiency! Note the php Tutorial version when file_get_contents opens a url file;Echo
The strtr () function converts special characters in a string.SyntaxStrtr (string, from, to) orStrtr (string, array)*/$ Addr = strtr ($ addr, "", "aao"); // The first call method.$ Trans = array ("hello" => "hi", "hi" => "hello"); // defines a
What is an array? An array is a programming structure. It is a variable that stores a group or a series of values.For example, personal identity registration during census, such as name, gender, ethnicity, and birth, can be used as an array.The
● Read filesThe first is to check whether a file can be read (Permission problem) or whether the file exists. We can use the is_readable function to obtain information .: The code is as follows: Copy code
. What is cookie?Cookie is a mechanism for storing data on a remote browser to track and identify users. 2. php Tutorial how to set cookieYou can use the setcookie () or setrawcookie () function in php to set the cookie. cookie is a part of the http
1. If you want to reply and undress, set it to $ iforder = 1; $ ifcircle = 0; then you can...2. You can put a group of images to remove them gradually .....3. Add the following code to create the file randimage. php:/*--------------------------------
Many websites provide links on the homepage to allow users to select their respective language pages, Chinese as the Chinese, and Korean as the Korean. So can I make a program to automatically help with the selection?The answer is yes. Everyone is
The for statement is the most basic statement in the loop control part of PHP (also multiple languages). The execution rules and basic usage of the for statement are not described here, see the for statement section in the PHP Manual. The syntax of
When you declare a class, you need to list all the variables and all functions that the object should have-called attributes and methods. The structure of a class is shown in list 1. Note that you can only declare variables or functions in braces.
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