PHP日常学习记录-4

34. //两种参数集合_POST() $_REQUEST
function input($arr,$brr){ 
		//var_dump($brr['json']);die;	
		$array=array();
		if($brr['json']=='undefined' ||$brr['json']==NULL){
		
			foreach($brr as $k=>$v){
				$array[$k]=$v;
			}
		}else{
		
			foreach($arr as $k=>$v){
				$array[$k]=$v;
			}
		}
		
		return $array;
	}


$input= input(_POST(),$_REQUEST);
$gh = $input['gh'];
对传来的参数进行统一,可同时用_POST和_REQUEST,


36. <?php $file = fopen("test.txt","r"); ?>
fopen() 函数打开文件或者 URL。 如果打开失败,本函数返回 FALSE。

37. 变量是存储信息的容器: http://www.w3school.com.cn/php/php_variables.asp 38.

38. sql判断数据库中该表是否在: https://zhidao.baidu.com/question/330963972518590485.html

39. PHP file_exists() 函数 file_exists() 函数检查文件或目录是否存在。

40.使用SVN上传代码如果发现错误,看log日志,查看一下哪里不小心改了,不要只看自己改的那部分,防止不小心动了其他代码,自己却不知道!

41.
$gh_db   = ($_REQUEST['gh']=='gh_0d75bc84fdf3') ? 'ecs273_dz': $_REQUEST['gh'];       
$sql = "select * from information_schema.columns WHERE TABLE_SCHEMA='$gh_db' AND table_name = 'ecs_goods' and column_name ='freight_template'"; //判断数据表是否有该字段
$row1 = $db->getRow($sql);
if($row1){
$str=',freight_template';   //判断然后拼装sql语句
$str1=",'$freight_template'";
$str2="freight_template = '$freight_template', ";	
}else{
$str='';$str1='';	$str2='';}
42. php strlen()函数返回字符串的长度

43. PHP strpos()函数 检索字符串中内指定的字符或文本,用来查找长字符串中的特定字符串

44. php常量 用来贯穿整个脚本自动全局
<?phpdefine("GREETING", "Welcome to W3School.com.cn!", true);echo greeting;?>

猜你喜欢

转载自blog.csdn.net/qq_36820328/article/details/79480289
今日推荐