当前位置 : 主页 > 网络编程 > PHP >

基础编程

来源:互联网 收集:自由互联 发布时间:2021-06-28
个人测试所用 1. [文件] Connect.class.php~531B 下载 (1) ?phprequire 'config.php';class Connect{private $con;function __construct(){$this-con=mysql_connect(constant("SERVER"),constant("USERNAME"),constant("PASSWORD"));if(!$this-con)
个人测试所用

1. [文件] Connect.class.php ~ 531B     下载(1)    

<?php	require 'config.php';class Connect{	private $con;	function __construct(){		$this->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);	}}?>

2. [文件] getdata.php ~ 1KB     下载(0)    

<?phpheader('Content-type:text/html;charset=utf-8');	// $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="http://localhost/test/test?name=jone&sex=male";	$arr=[];	var_dump(parse_str($str,$arr));		$find=['a','p','l'];	$replace=['apple','peer','line'];	var_dump(str_replace($find,$replace,'i like a'));								?>

3. [文件] getdata.php ~ 1KB     下载(0)    

<?phpheader('Content-type:text/html;charset=utf-8');	// $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="http://localhost/test/test?name=jone&sex=male";	$arr=[];	var_dump(parse_str($str,$arr));		$find=['a','p','l'];	$replace=['apple','peer','line'];	var_dump(str_replace($find,$replace,'i like a'));								?>

4. [文件] index.php ~ 20KB     下载(1)    

5. [文件] index.php ~ 20KB     下载(0)    

6. [文件] getdata.php ~ 1KB     下载(0)    

<?phpheader('Content-type:text/html;charset=utf-8');	// $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="http://localhost/test/test?name=jone&sex=male";	$arr=[];	var_dump(parse_str($str,$arr));		$find=['a','p','l'];	$replace=['apple','peer','line'];	var_dump(str_replace($find,$replace,'i like a'));								?>

7. [文件] Connect.class.php ~ 531B     下载(0)    

<?php	require 'config.php';class Connect{	private $con;	function __construct(){		$this->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);	}}?>

8. [文件] test.php ~ 1KB     下载(0)    

<?php
//	echo 'nihao';
//	$name='xicong';
//
//	$curl=curl_init();
//	curl_setopt($curl,CURLOPT_URL,'localhost/test/getdata.php');
//	curl_setopt($curl,CURLOPT_HEADER,1);
//	curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
//	curl_setopt($curl,CURLOPT_POST,1);
//	$header=[];
//	$header[]='Accept:application/json';
//	$header[]='charset:utf-8';
//	$data=[
//		"name"=>'jey',
//		"sex"=>'male',
//	];
//	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='[{"Name":"a1","Number":"123","Contno":"000","QQNo":""},{"Name":"a1","Number":"123","Contno":"000","QQNo":""},{"Name":"a1","Number":"123","Contno":"000","QQNo":""}]'; 
	// $data=json_decode($data); 
	// var_dump($data);
	
//	echo <<<aaa
//	<html>
//	<h1>	sadfasdf</h1>
//	</html>
//aaa;

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


	
	
?>

9. [文件] test.php ~ 1KB     下载(0)    

<?php
//	echo 'nihao';
//	$name='xicong';
//
//	$curl=curl_init();
//	curl_setopt($curl,CURLOPT_URL,'localhost/test/getdata.php');
//	curl_setopt($curl,CURLOPT_HEADER,1);
//	curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
//	curl_setopt($curl,CURLOPT_POST,1);
//	$header=[];
//	$header[]='Accept:application/json';
//	$header[]='charset:utf-8';
//	$data=[
//		"name"=>'jey',
//		"sex"=>'male',
//	];
//	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='[{"Name":"a1","Number":"123","Contno":"000","QQNo":""},{"Name":"a1","Number":"123","Contno":"000","QQNo":""},{"Name":"a1","Number":"123","Contno":"000","QQNo":""}]'; 
	// $data=json_decode($data); 
	// var_dump($data);
	
//	echo <<<aaa
//	<html>
//	<h1>	sadfasdf</h1>
//	</html>
//aaa;

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


	
	
?>

10. [文件] test.php ~ 1KB     下载(0)    

<?php
//	echo 'nihao';
//	$name='xicong';
//
//	$curl=curl_init();
//	curl_setopt($curl,CURLOPT_URL,'localhost/test/getdata.php');
//	curl_setopt($curl,CURLOPT_HEADER,1);
//	curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
//	curl_setopt($curl,CURLOPT_POST,1);
//	$header=[];
//	$header[]='Accept:application/json';
//	$header[]='charset:utf-8';
//	$data=[
//		"name"=>'jey',
//		"sex"=>'male',
//	];
//	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='[{"Name":"a1","Number":"123","Contno":"000","QQNo":""},{"Name":"a1","Number":"123","Contno":"000","QQNo":""},{"Name":"a1","Number":"123","Contno":"000","QQNo":""}]'; 
	// $data=json_decode($data); 
	// var_dump($data);
	
//	echo <<<aaa
//	<html>
//	<h1>	sadfasdf</h1>
//	</html>
//aaa;

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


	
	
?>

11. [文件] test.php ~ 1KB     下载(0)    

<?php
//	echo 'nihao';
//	$name='xicong';
//
//	$curl=curl_init();
//	curl_setopt($curl,CURLOPT_URL,'localhost/test/getdata.php');
//	curl_setopt($curl,CURLOPT_HEADER,1);
//	curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
//	curl_setopt($curl,CURLOPT_POST,1);
//	$header=[];
//	$header[]='Accept:application/json';
//	$header[]='charset:utf-8';
//	$data=[
//		"name"=>'jey',
//		"sex"=>'male',
//	];
//	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='[{"Name":"a1","Number":"123","Contno":"000","QQNo":""},{"Name":"a1","Number":"123","Contno":"000","QQNo":""},{"Name":"a1","Number":"123","Contno":"000","QQNo":""}]'; 
	// $data=json_decode($data); 
	// var_dump($data);
	
//	echo <<<aaa
//	<html>
//	<h1>	sadfasdf</h1>
//	</html>
//aaa;

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


	
	
?>
网友评论