基礎編程
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) [全螢幕預覽]
下載
[全螢幕預覽] 6. [文件] getdata.php ~ 1KB 下載(0)
跳至 [1] [2] [3] [7] [8] [9] [10] [11]
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)!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能

SublimeText3 Linux新版
SublimeText3 Linux最新版