PHP开发中常用到一些技巧
Jun 06, 2016 pm 07:56 PM以下为引用的内容: if(! empty($_POST['checkbox'])) { $expr = join(",", $_POST['checkbox']); $sql = "select * from tbl_name where field in ($expr)"; } 如果参与控制的字段是数值型的,则 if(! empty($_POST['checkbox'])) { $expr = "'".join("','",
以下为引用的内容:
if(! empty($_POST['checkbox'])) {
$expr = join(",", $_POST['checkbox']);
$sql = "select * from tbl_name where field in ($expr)";
}
如果参与控制的字段是数值型的,则
if(! empty($_POST['checkbox'])) {
$expr = "'".join("','", $_POST['checkbox']).".";
$sql = "select * from tbl_name where field in ($expr)";
}
PHP判断Form表单是否提交
以下为引用的内容:
$action=$HTTP_POST_VARS["Button1"];
if($action=="提交")
{
//执行表单操作
}
else
{
//读取默认值
}
PHP 获取字符串长度
strlen($myrow[1])
PHP Url转向
Header("Location: ".$_SERVER["HTTP_REFERER"]);
PHP超全局对象
以下为引用的内容:
$a = 1;
$b = 2;
function Sum()
{
$GLOBALS["b"] = $GLOBALS["a"] + $GLOBALS["b"];
}
Sum();
echo $b;
?>
PHP 表单取值
以下为引用的内容:
如果 mothod="get" 就用 $_GET["test"] 代替$test
如果 mothod="post" 就用 $_POST["test"] 代替$test
PHP取得当前IP
=$HTTP_SERVER_VARS["REMOTE_ADDR"]?>
PHP 取得当前时间
echo date("Y-m-d G:i:s");
?>
date("Y年m月d日")
Date ("Y-n-j")

Heißer Artikel

Hot-Tools-Tags

Heißer Artikel

Heiße Artikel -Tags

Notepad++7.3.1
Einfach zu bedienender und kostenloser Code-Editor

SublimeText3 chinesische Version
Chinesische Version, sehr einfach zu bedienen

Senden Sie Studio 13.0.1
Leistungsstarke integrierte PHP-Entwicklungsumgebung

Dreamweaver CS6
Visuelle Webentwicklungstools

SublimeText3 Mac-Version
Codebearbeitungssoftware auf Gottesniveau (SublimeText3)

Heiße Themen

PHP 8.4 Installations- und Upgrade-Anleitung für Ubuntu und Debian

So richten Sie Visual Studio-Code (VS-Code) für die PHP-Entwicklung ein
