您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

零基础编程

2024/6/7 11:31:28发布32次查看
基础编程
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
<?php header('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=" $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
<?php header('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=" $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 下载(0) [全屏预览]
5. [文件] index.php ~ 20kb 下载(0) [全屏预览]
6. [文件] getdata.php ~ 1kb 下载(0) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览] <?php header('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=" $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) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览] <?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) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]
'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 // // sadfasdf// //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) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]
'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 // // sadfasdf// //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) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]
'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 // // sadfasdf// //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) 跳至 [1] [2] [3] [6] [7] [8] [9] [10] [11] [全屏预览]
'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 // // sadfasdf// //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); ?>
以上就是基础编程的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product