pHp中文网零基础,零基础编程

基础编程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() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/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() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/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() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter1: " . $counter1() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/n";

echo "counter2: " . $counter2() . "
/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 <<

sadfasdfaaa;

$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 <<

sadfasdfaaa;

$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 <<

sadfasdfaaa;

$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 <<

sadfasdfaaa;

$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)!

相关标签:基础编程

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/364625.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

正确判断js数据类型 总结记录

正确判断js数据类型 总结记录 判断js中的数据类型有一下几种方法&#xff1a;typeof、instanceof、 constructor、 prototype、 三方库。 js六大数据类型 number&#xff1a; 数字&#xff0c;整数、浮点数等等&#xff0c; string&#xff1a; 单引号或者双引号来说明&…

wait/notify实现线程间的通信

使线程之间进行通信之后&#xff0c;系统间的交互性更加强大&#xff0c;在大大提高CPU利用率的同时还会使程序对各线程任务在处理的过程中进行有效的把控与监督。 1.不使用wait/notify实现线程间通信 使用sleep()while(true)也可以实现线程间通信。 例如:两个线程&#xff0c…

项目学生:使用AOP简化代码

这是Project Student的一部分。 许多人坚信方法应适合您的编辑器窗口&#xff08;例如20行&#xff09;&#xff0c;而有些人则认为方法应小于此范围。 这个想法是一种方法应该做一件事&#xff0c;而只能做一件事。 如果它做的还不止于此&#xff0c;则应将其分解为多种方法&…

洛谷 P3367 【模板】并查集

嗯... 题目链接&#xff1a;https://www.luogu.org/problemnew/show/P3367 并查集可以支持的操作&#xff1a;“并”和“查”。然后这道题主要就是考察这两种操作。将每一个点的“父亲”初始化为自己&#xff0c;然后分别进行“并”和“查”。 “并”&#xff1a;用递归函数fin…

MySQL使用学习使用,mysql学习--基本使用_MySQL

一旦安装完成&#xff0c;MySQL 服务器应该自动启动。sudo start mysql #手动的话这样启动sudo stop mysql #手动停止当你修改了配置文件后&#xff0c;你需要重启 mysqld 才能使这些修改生效。要想检查 mysqld 进程是否已经开启&#xff0c;可以使用下面的命令&#xff1a;pgr…

解决@vue/cli 创建项目是安装chromedriver时失败的问题

最近在使用新版vue的命令行工具创建项目时&#xff0c;安装chromedriver老是失败&#xff0c;导致后面的步骤也没有进行。网上搜索了一下&#xff0c;全是使用 npm install chromedriver --chromedriver_cdnurlhttp://cdn.npm.taobao.org/dist/chromedriver 安装的&#xff0c…

Java 8 Friday Goodies:Lambda和排序

在Data Geekery &#xff0c;我们喜欢Java。 而且&#xff0c;由于我们真的很喜欢jOOQ的流畅的API和查询DSL &#xff0c;我们对Java 8将为我们的生态系统带来什么感到非常兴奋。 我们已经写了一些关于Java 8好东西的博客 &#xff0c;现在我们觉得是时候开始一个新的博客系列了…

npm 包下载的各种姿势

最近在写Node程序的时候&#xff0c;突然对 npm install 的-save和-save-dev 这两个参数的使用比较混乱。其实博主在这之前对这两个参数的理解也是模糊的&#xff0c;各种查资料和实践后对它们之间的异同点略有理解。遂写下这篇文章避免自己忘记&#xff0c;同时也给node猿友一…

39.数组中数值和下标相等的元素

题目描述&#xff1a; 假设一个单调递增的数组里的每个元素都是整数且是唯一的&#xff0c;请编程实现一个函数&#xff0c;找出数组中任意一个数值等于其下标的元素&#xff0c;例如&#xff0c;在数组{-3&#xff0c;-1,1,3,5}中数字3和它的下标相同。 思路分析&#xff1a; …

php读取xml标签内容,从xml php5获取内容

我正在研究一个支付解决方案,需要一些关于php的帮助。我正在做一个httprequest,作为回应,我将得到一些xml。XML可能如下所示:1description121510authurlsettleurl基本上我想做的是从标签中获取内容并将其保存为字符串。我试过这个:$order <?xml version"1.0" en…

jquery3和layui冲突导,致使用layui.layer.full弹出全屏iframe窗口时高度152px问题

项目中使用的jquery版本是jquery-3.2.1&#xff0c;在使用layui弹出全屏iframe窗口时&#xff0c;iframe窗口顶部总是出现一个152px高的滚动窗口无法实现真正全屏&#xff0c;代码如下&#xff1a; <!DOCTYPE html> <html> <head><meta charset"utf-…

ADF Faces。 立即的自定义客户端事件

在本文中&#xff0c;我将重点介绍ADF Faces Javascript API方法以从客户端触发自定义事件。 例如&#xff1a; function cliListener(actionEvent) {AdfCustomEvent.queue(actionEvent.getSource(), "servListener",null, true);}我们可以使用af&#xff1a;client…

react-native页面间传递数据的几种方式

1. 利用react-native 事件DeviceEventEmitter 监听广播 应用场景&#xff1a; - 表单提交页面&#xff0c; A页面跳转到B页面选人&#xff0c; 然后返回A页面&#xff0c; 需要将B页面选择的数据传回A页面。 - 多个多媒体来回切换播放&#xff0c;暂停后二次继续播放等问题。…

php数据库操作类的调用优化,PHP PDO优化数据库操作类 多数据库驱动类

就是做一下整理 PHP PDO类操作。简化操作流程更多内容http://git.oschina.net/youkuiyuan/yky_test/blob/master/class/pdo.class.php点击链接加入群【微信开发探讨群】&#xff1a;http://jq.qq.com/?_wv1027&kcsNcd9群号&#xff1a;330393916欢迎浏览&#xff1a;www.z…

Genymotion模拟器安装ARM架构编译应用失败解决方案

我们在安装一些应用到Genymotion模拟器会提示&#xff1a;adb: failed to install xx.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res-113] 原因是Genymotion采用的编译方式是x86&#xff0c;默认不支持ARM架构编译的应用&#xff0…

CentOS7.5 yum 安装与配置MySQL5.7.24

安装环境&#xff1a;CentOS7 64位 MINI版&#xff0c;安装MySQL5.7 1、配置YUM源 在MySQL官网中下载YUM源rpm安装包&#xff1a;https://dev.mysql.com/downloads/repo/yum/ 下面已经提供一个YUM源安装包,如果不需要特定版本可直接使用我提供的5.7.24版本 # 下载mysql源安装包…

5种改善服务器日志记录的技术

在最近的时间里&#xff0c;我们已经看到了许多工具可以帮助您理解日志。 诸如Scribe和LogStash之类的开源项目&#xff0c;诸如Splunk之类的本地工具以及诸如SumoLogic和PaperTrail之类的托管服务。 这些都可以帮助您将大量日志数据减少为更有意义的内容。 它们共有一个共同点…

在vue项目中引用element-ui时 让el-input 获取焦点的方法

在制作项目的时候遇到一个需求&#xff0c;点击一个按钮弹出一个input输入框&#xff0c;并让输入框获得焦点&#xff0c;项目中引用了element-ui 在网上查找了很多方法&#xff0c;但是在实际使用中发现了一个问题无论是使用$ref获取input元素然后使用focus方法还是使用饿了么…

java excel处理框架,Java三方—-excel框架之POI的使用一

Apache POI是Apache软件基金会的开放源码函式库&#xff0c;POI提供API给Java程序对Microsoft Office格式档案读和写的功能。pdf框架之IText的使用&#xff0c;参见我的博客&#xff1a;Java三方—->pdf框架之IText的使用。今天我们开始POI中Excel部分的学习。POI框架的简单…

关于background-*的一些属性

1、盒模型 盒模型从外到内一次为&#xff1a;margin-box、border-box、padding-box、content-box。 2、一些属性设置的相对位置 ⑴background-position的属性值&#xff08;top/right/bottom/left/center&#xff09;起始位置是相对于padding-box外边沿开始的&#xff0c;…