> php教程 > PHP源码 > 본문

제로 기본 프로그래밍

PHP中文网
풀어 주다: 2016-08-18 08:57:53
원래의
1087명이 탐색했습니다.

기본 프로그래밍

con=mysql_connect(constant("SERVER"),constant("USERNAME"),constant("PASSWORD"));		
if(!$this->con){			
die('connet to mysql error'.mysql_error());		

}		
else{			
mysql_select_db(constant("DATABASE"),$this->con);		
}	
}	
function select($sql){		
$result=mysql_query($sql,$this->con);				
return $row=mysql_fetch_array($result);			
}	
function find($sql){		
$result=mysql_query($sql,$this->con);		
$row=mysql_fetch_assoc($result);	
}
}
?>
로그인 후 복사

                                 🎜>

3. 🎜>

<?php
header(&#39;Content-type:text/html;charset=utf-8&#39;);	
// $data=extract($_POST);		
// return $name;	
// return 
$sex;	
$getInfo=function($str){		
return $str;	
};	
echo $getInfo("a");		
function callFunc($func){		
$func("argv");	
};	
callFunc(function($str){		
echo $str;	
});			
function get($func){		
$func("res");	
}	
get(function($str){		
echo $str;	
});		
function callback($fun){		
$fun();	
}	
$msg="hello everyone";	
$func=function() use($msg){		
echo "this is the ".$msg;	
};	
$msg="hello everybody";	
callback($func);				
function counter() 
{		
$counter = 1;  		
return function() use(&$counter) {			
return $counter ++;	
};			
}  
$counter1 = counter();  
$counter2 = counter();  
echo "counter1: " . $counter1() . "<br />/n";  
echo "counter1: " . $counter1() . "<br />/n";  
echo "counter1: " . $counter1() . "<br />/n";  
echo "counter1: " . $counter1() . "<br />/n";  
echo "counter2: " . $counter2() . "<br />/n";  
echo "counter2: " . $counter2() . "<br />/n";  
echo "counter2: " . $counter2() . "<br />/n";  
echo "counter2: " . $counter2() . "<br />/n";  	
var_dump(counter() instanceof Closure);	
$str=" 
$arr=[];	
var_dump(parse_str($str,$arr));		
$find=[&#39;a&#39;,&#39;p&#39;,&#39;l&#39;];	
$replace=[&#39;apple&#39;,&#39;peer&#39;,&#39;line&#39;];	
var_dump(str_replace($find,$replace,&#39;i like a&#39;));								
?>
로그인 후 복사

4.

<?php
header(&#39;Content-type:text/html;charset=utf-8&#39;);	
// $data=extract($_POST);		
// return $name;	
// return $sex;	
$getInfo=function($str){		
return $str;	
};	
echo $getInfo("a");		
function callFunc($func){		
$func("argv");	};	
callFunc(function($str){		
echo $str;	
});			
function get($func){		
$func("res");	
}	

get(function($str){		
echo $str;	
});		
function callback($fun){		
$fun();	
}	
$msg="hello everyone";	
$func=function() use($msg){		
echo "this is the ".$msg;	
};	
$msg="hello everybody";	
callback($func);				
function counter() {		

$counter = 1;  		
return function() use(&$counter) {			
return $counter ++;	
};			
}  
$counter1 = counter();  
$counter2 = counter();  
echo "counter1: " . $counter1() . "<br />/n";  
echo "counter1: " . $counter1() . "<br />/n";  
echo "counter1: " . $counter1() . "<br />/n";  
echo "counter1: " . $counter1() . "<br />/n";  
echo "counter2: " . $counter2() . "<br />/n";  
echo "counter2: " . $counter2() . "<br />/n";  
echo "counter2: " . $counter2() . "<br />/n";  
echo "counter2: " . $counter2() . "<br />/n";  	
var_dump(counter() instanceof Closure);	
$str=" 
$arr=[];	
var_dump(parse_str($str,$arr));		
$find=[&#39;a&#39;,&#39;p&#39;,&#39;l&#39;];	
$replace=[&#39;apple&#39;,&#39;peer&#39;,&#39;line&#39;];	
var_dump(str_replace($find,$replace,&#39;i like a&#39;));								
?>
로그인 후 복사
[파일]

index.php ~ 20KB <)> (0)

[전체화면 미리보기]

5. 🎜> index.php 다운로드 ~ 20KB 다운로드 (0)

                                                                                                                             🎜>

[파일]
getdata.php ~ 1KB 다운로드

(0)

건너뛰기                                                 [1] [2] [ 3] ~ ~ [7] [8] >                  [9] >                                  [10] ~                     

7. [文件] Connect.class.php ~ 531B 下载(0) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]

<?php	
require &#39;config.php&#39;;
class Connect{	
private $con;	
function __construct(){		
$this->con=mysql_connect(constant("SERVER"),constant("USERNAME"),constant("PASSWORD"));		
if(!$this->con){			
die(&#39;connet to mysql error&#39;.mysql_error());		
}		
else{			
mysql_select_db(constant("DATABASE"),$this->con);		
}	
}	
function select($sql){		
$result=mysql_query($sql,$this->con);				
return $row=mysql_fetch_array($result);			
}	
function find($sql){		
$result=mysql_query($sql,$this->con);		
$row=mysql_fetch_assoc($result);	
}}
?>
로그인 후 복사


8. [文件] test.php ~ 1KB 下载(0) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]

&#39;jey&#39;,
//		"sex"=>&#39;male&#39;,
//	];
//	curl_setopt($curl,CURLOPT_POSTFIELDS,$data);
//	curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
//	$data=curl_exec($curl);
//	curl_close($curl);
//	echo ($data);
//
	
	
	
	
	// $str="这是一个中文";
	// var_dump(json_encode($str,JSON_UNESCAPED_UNICODE));
	
	// $data=&#39;[{"Name":"a1","Number":"123","Contno":"000","QQNo":""},
	{"Name":"a1","Number":"123","Contno":"000","QQNo":""},
	{"Name":"a1","Number":"123","Contno":"000","QQNo":""}]&#39;; 
	// $data=json_decode($data); 
	// var_dump($data);
	
//	echo <<<aaa
//	//		sadfasdf//	//aaa;

$year=2014;
function getDetailDate($year){
    $time=date(&#39;Y&#39;,$year);
    $first=$year.&#39;-01-01&#39;;
    $dates=array(
        "first"=>date("Y-m-d",strtotime($first)),
        "martin"=>date("Y-m-d",strtotime(&#39;+1 day&#39;)),
    );
	$father="mother"; 
    $mother="son"; 
    echo $$father; 
    var_dump( $dates);
}
getDetailDate($year);


	
	
?>
로그인 후 복사
로그인 후 복사
로그인 후 복사
로그인 후 복사


9. [文件] test.php ~ 1KB 下载(0) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]

&#39;jey&#39;,
//		"sex"=>&#39;male&#39;,
//	];
//	curl_setopt($curl,CURLOPT_POSTFIELDS,$data);
//	curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
//	$data=curl_exec($curl);
//	curl_close($curl);
//	echo ($data);
//
	
	
	
	
	// $str="这是一个中文";
	// var_dump(json_encode($str,JSON_UNESCAPED_UNICODE));
	
	// $data=&#39;[{"Name":"a1","Number":"123","Contno":"000","QQNo":""},
	{"Name":"a1","Number":"123","Contno":"000","QQNo":""},
	{"Name":"a1","Number":"123","Contno":"000","QQNo":""}]&#39;; 
	// $data=json_decode($data); 
	// var_dump($data);
	
//	echo <<<aaa
//	//		sadfasdf//	//aaa;

$year=2014;
function getDetailDate($year){
    $time=date(&#39;Y&#39;,$year);
    $first=$year.&#39;-01-01&#39;;
    $dates=array(
        "first"=>date("Y-m-d",strtotime($first)),
        "martin"=>date("Y-m-d",strtotime(&#39;+1 day&#39;)),
    );
	$father="mother"; 
    $mother="son"; 
    echo $$father; 
    var_dump( $dates);
}
getDetailDate($year);


	
	
?>
로그인 후 복사
로그인 후 복사
로그인 후 복사
로그인 후 복사


10. [文件] test.php ~ 1KB 下载(0) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]

&#39;jey&#39;,
//		"sex"=>&#39;male&#39;,
//	];
//	curl_setopt($curl,CURLOPT_POSTFIELDS,$data);
//	curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
//	$data=curl_exec($curl);
//	curl_close($curl);
//	echo ($data);
//
	
	
	
	
	// $str="这是一个中文";
	// var_dump(json_encode($str,JSON_UNESCAPED_UNICODE));
	
	// $data=&#39;[{"Name":"a1","Number":"123","Contno":"000","QQNo":""},
	{"Name":"a1","Number":"123","Contno":"000","QQNo":""},
	{"Name":"a1","Number":"123","Contno":"000","QQNo":""}]&#39;; 
	// $data=json_decode($data); 
	// var_dump($data);
	
//	echo <<<aaa
//	//		sadfasdf//	//aaa;

$year=2014;
function getDetailDate($year){
    $time=date(&#39;Y&#39;,$year);
    $first=$year.&#39;-01-01&#39;;
    $dates=array(
        "first"=>date("Y-m-d",strtotime($first)),
        "martin"=>date("Y-m-d",strtotime(&#39;+1 day&#39;)),
    );
	$father="mother"; 
    $mother="son"; 
    echo $$father; 
    var_dump( $dates);
}
getDetailDate($year);


	
	
?>
로그인 후 복사
로그인 후 복사
로그인 후 복사
로그인 후 복사


11. [文件] test.php ~ 1KB 下载(0) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]

&#39;jey&#39;,
//		"sex"=>&#39;male&#39;,
//	];
//	curl_setopt($curl,CURLOPT_POSTFIELDS,$data);
//	curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
//	$data=curl_exec($curl);
//	curl_close($curl);
//	echo ($data);
//
	
	
	
	
	// $str="这是一个中文";
	// var_dump(json_encode($str,JSON_UNESCAPED_UNICODE));
	
	// $data=&#39;[{"Name":"a1","Number":"123","Contno":"000","QQNo":""},
	{"Name":"a1","Number":"123","Contno":"000","QQNo":""},
	{"Name":"a1","Number":"123","Contno":"000","QQNo":""}]&#39;; 
	// $data=json_decode($data); 
	// var_dump($data);
	
//	echo <<<aaa
//	//		sadfasdf//	//aaa;

$year=2014;
function getDetailDate($year){
    $time=date(&#39;Y&#39;,$year);
    $first=$year.&#39;-01-01&#39;;
    $dates=array(
        "first"=>date("Y-m-d",strtotime($first)),
        "martin"=>date("Y-m-d",strtotime(&#39;+1 day&#39;)),
    );
	$father="mother"; 
    $mother="son"; 
    echo $$father; 
    var_dump( $dates);
}
getDetailDate($year);


	
	
?>
로그인 후 복사
로그인 후 복사
로그인 후 복사
로그인 후 복사

         

以上就是基础编程的内容,更多相关内容请关注PHP中文网(www.php.cn)!

                 


       

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!