基础编程
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); ?>
以上就是基础编程的内容,更多相关内容请关注PHP中文网(www.php.cn)!
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章
刺客信条阴影:贝壳谜语解决方案
3 周前ByDDD
Windows 11 KB5054979中的新功能以及如何解决更新问题
3 周前ByDDD
在哪里可以找到原子中的起重机控制钥匙卡
3 周前ByDDD
<🎜>:死铁路 - 如何完成所有挑战
4 周前ByDDD
Atomfall指南:项目位置,任务指南和技巧
1 个月前ByDDD

热工具

记事本++7.3.1
好用且免费的代码编辑器

Atom编辑器mac版下载
最流行的的开源编辑器

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

禅工作室 13.0.1
功能强大的PHP集成开发环境

WebStorm Mac版
好用的JavaScript开发工具