Basic Programming
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); } } ?>
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.
[File] index. php ~ 20KB
Download
(0)
(0) ~ 1KB
Download (0) Skip to
[1]
[2]
[3]
[7]
[8]
[9]
[10]
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)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
