All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
PHP动态网站开发中常用的8个小技巧_php资料_编程技术

Writer: aaa Article type: Programming skills(编程技巧) Time: 2013/12/21 22:25:19 Browse times: 302 Comment times: 0

PHP动态网站开发中常用的8个小技巧_php资料_编程技术


Head photo

Go homepage
Upload pictures
Write articles

PHP动态网站开发中常用的8个小技巧_php资料_编程技术-你的首页-uuhomepage.com
本文总结了PHP日常开发中常用的8个小技巧。

PHP批最取得checkbox的值

1、命名

2、使用

当计划当作sql指令的一部分时:如果参与控制的字段是数值型的,则

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

PHP 取得当前时间

echo date("Y-m-d G:i:s");
?>
date("Y年m月d日")
Date ("Y-n-j")





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.