Heim  >  Artikel  >  Backend-Entwicklung  >  android应用程序开发 PHP开发中常用的8个小技巧

android应用程序开发 PHP开发中常用的8个小技巧

WBOY
WBOYOriginal
2016-07-29 08:38:391032Durchsuche

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
=$HTTP_SERVER_VARS["REMOTE_ADDR"]?>
PHP 取得当前时间
echo date("Y-m-d G:i:s");
?>
date("Y年m月d日")
Date ("Y-n-j")

以上就介绍了android应用程序开发 PHP开发中常用的8个小技巧,包括了android应用程序开发方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn