8 tips commonly used in PHP website development, php website development tips_PHP tutorial
WBOY
Release: 2016-07-13 10:06:29
Original
945 people have browsed it
8 tips commonly used in PHP website development, PHP website development tips
PHP is a server-side scripting language used to create dynamic WEB pages. Like ASP and ColdFusion, users can use a mixture of PHP and HTML to write WEB pages. When a visitor browses to the page, the server will first process the PHP commands in the page, and then transmit the processed results together with the HTML content to Access browser. But unlike ASP or ColdFusion, PHP is an open source program with good cross-platform compatibility. Users can run PHP on Windows NT systems and many versions of Unix systems, and can run PHP as a built-in module of the Apache server or as a CGI program. This article summarizes 8 tips commonly used in daily PHP development.
PHP batch gets the checkbox value
1. Naming
Copy code The code is as follows:
$expr = join(“,”, $_POST['checkbox']);
$sql = “select * from tbl_name where field in ($expr)”;
}
If the field participating in the control is numeric, then
Copy code The code is as follows:
if(! empty($_POST['checkbox'])) {
$expr = “‘”.join(“‘,'”, $_POST['checkbox']).".";
$sql = “select * from tbl_name where field in ($expr)”;
}
3. PHP determines whether the Form is submitted
Copy code The code is as follows:
$action=$HTTP_POST_VARS["Button1"];
if($action=="Submit")
{
//Perform form operations
}
else
{
//Read default value
}
If method="get" use $_GET["test"] instead of $test
If method="post" use $_POST["test"] instead of $test
7. Get the current IP with PHP
Copy code The code is as follows:
=$HTTP_SERVER_VARS["REMOTE_ADDR"]?>
8. Get the current time with PHP
Copy code The code is as follows:
echo date(“Y-m-d G:i:s”);
?>
date("Y year m month d day")
Date (“Y-n-j”)
http://www.bkjia.com/PHPjc/958253.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/958253.htmlTechArticle8 tips commonly used in PHP website development, php website development tips PHP is a method for creating dynamic Server-side scripting language for WEB pages. Like ASP and ColdFusion, users can mix...
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn