摘要: <?php //想要获取a.jpg这个文件名的基本信息 // require '10_return.php'; require 'library/strinf.php'; print_r(getFileInfo('global.css')); echo '<hr>'; echo uuid(); ec 阅读全文
posted @ 2020-03-11 23:14 lujieting0 阅读(177) 评论(0) 推荐(0) 编辑
摘要: <?php //单个文件上传时的数组结构如下: $array = [ 'file' => [ 'name' => '', 'size' => '', 'error' => '', 'type' => '', 'tmp_name' => '', 阅读全文
posted @ 2020-03-11 23:13 lujieting0 阅读(220) 评论(0) 推荐(0) 编辑
摘要: <?php //计算任意两个数字之和 function sum($arg1,$arg2) { $sum = $arg1 + $arg2; return $sum; } $n = sum(3,5); //输出函数调用的结果 echo sum(3,5); $n = sum(2,1); //函数的结果作为 阅读全文
posted @ 2020-03-11 23:12 lujieting0 阅读(99) 评论(0) 推荐(0) 编辑
摘要: <?php //没有参数的自定义函数 function sum(){ for ($i = 0 ; $i <= 100; $i++){ $sum += $i; } echo $sum; } sum(); echo '中国'; sum(); ////////////////////////////// 阅读全文
posted @ 2020-03-11 23:11 lujieting0 阅读(237) 评论(0) 推荐(0) 编辑
摘要: <?php /** * 构建文件上传的基本信息 */ function builderInfo() { $index = 0; foreach ($_FILES as $item){ //多个 if (is_array($item['name'])){ foreach ($item['error'] 阅读全文
posted @ 2020-03-11 23:10 lujieting0 阅读(227) 评论(0) 推荐(0) 编辑
摘要: <?php /** * 产生UUID */ function uuid() { $uuiqId = md5(uuiqid(mt_rand() . microtiome())); $uuid = substr($uniqId, 0, 8) . '-' $uuid = substr($uniqId, 8 阅读全文
posted @ 2020-03-11 23:09 lujieting0 阅读(102) 评论(0) 推荐(0) 编辑
摘要: <?php /** * */ function insert($array, $table){ $fields = implode(',', array_key($array)); $values = "'" . implode("','", $array) . "'"; $sql = "INSER 阅读全文
posted @ 2020-03-11 23:08 lujieting0 阅读(157) 评论(0) 推荐(0) 编辑
摘要: <?php if (is_array($_FILES['file']['name'])){ foreach ($_FILES['file']['error'] as $key => $error){ if ($error == UPLOAD_ERR_OK){ //获取当前上传文件的名称(原始名称) 阅读全文
posted @ 2020-03-11 23:07 lujieting0 阅读(258) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2020-03-11 23:05 lujieting0 阅读(616) 评论(0) 推荐(0) 编辑
摘要: <?php echo $_POST['username']; echo $_POST['password']; //获取上传文件的名称 $filename = $_FILES['file']['name']; //获取上传文件的错误代码 $error = $_FILES['file']['error 阅读全文
posted @ 2020-03-11 23:02 lujieting0 阅读(268) 评论(0) 推荐(0) 编辑
摘要: <?php //$arr是一个关联数组,有5个成员 //name,sex,age,education,mobile $users = [ 'name' => ['张三','李四','王五','赵六'], 'sex' => ['男','女','女','男'], 'age' => [12,13,14,1 阅读全文
posted @ 2020-03-11 23:01 lujieting0 阅读(121) 评论(0) 推荐(0) 编辑
摘要: <?php $arr = [ ['张三','男','22'], ['李四','女','23'], ['王五','男','24'], ['赵六','女','25'], ]; //张三,男,22|李四,女,23|王五,男,24|赵六,女,25 foreach ($arr as $item){ $temp 阅读全文
posted @ 2020-03-11 22:59 lujieting0 阅读(126) 评论(0) 推荐(0) 编辑
摘要: <?php //包含了N多个人的基本信息(姓名、性别、年龄) $str = '张三,男,22|李四,女,23|王五,男,17'; /** * $arr = [ * ['张三','男',22]; * ['张三','男',22]; * ['张三','男',22]; * ]; * */ //转换成 $ar 阅读全文
posted @ 2020-03-11 22:57 lujieting0 阅读(840) 评论(0) 推荐(0) 编辑
摘要: <?php $products = [ ['id' => 1, 'productName' => '商品1', 'productsPrice' => 500, 'productImage' => 'a1.jpg'], ['id' => 2, 'productName' 阅读全文
posted @ 2020-03-11 22:56 lujieting0 阅读(206) 评论(0) 推荐(0) 编辑
摘要: <?php $arr = ['C','D','E']; echo '原数组有', count($arr), '个成员'; echo '他们是:', implode(',',$arr); $length = array_unshift($arr,'A','B'); echo '现有',$length, 阅读全文
posted @ 2020-03-11 22:47 lujieting0 阅读(238) 评论(0) 推荐(0) 编辑
摘要: <?php $arr = 'GIF','JPG','PNG','SWF','PSD']; // foreach ($arr as $value){ // $temp[] = strtolower($value); // } // print_r($temp); $arr = array_map('s 阅读全文
posted @ 2020-03-11 22:44 lujieting0 阅读(115) 评论(0) 推荐(0) 编辑
摘要: <?php //end() 与 count($array)-1 的区别 $filename = 'a.b.c.jpg'; $array = explode('.', $filename); echo end($array); echo $array[count($array)-1]; $array  阅读全文
posted @ 2020-03-11 22:42 lujieting0 阅读(226) 评论(0) 推荐(0) 编辑
摘要: <?php echo strpos('abcd','a'),'<hr>'; var_dump(strpos('abcd','C')); var_dump(stripos('abcd','C')); var_dump(strrpos('abcd','a')); //获取文件的扩展名 $filename 阅读全文
posted @ 2020-03-11 22:38 lujieting0 阅读(116) 评论(0) 推荐(0) 编辑
摘要: <?php //经典写法 $str = 'ZEND_ConTROLLeR_fRonT'; //全部转换成小写字母 $str = strtolower($str); //将zend_controller_front通过str_replace函数变成 $str = str_repeat('_',' ', 阅读全文
posted @ 2020-03-11 22:35 lujieting0 阅读(148) 评论(0) 推荐(0) 编辑
摘要: <?php $str = 'JavaScript'; echo substr($str,0,4),'<hr>'; echo substr($str,4),'<hr>'; $str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz12345 阅读全文
posted @ 2020-03-11 22:34 lujieting0 阅读(97) 评论(0) 推荐(0) 编辑