TypechoJoeTheme

至尊技术网

统计
登录
用户名
密码
/
注册
用户名
邮箱
搜索到 116 篇与 的结果
2020-12-28

PHP中面向对象3种权限详解

PHP中面向对象3种权限详解
public(公有)protected(受保护)private(私有)外部YNN子类中YYN本类中YYY<?php class Human { public $money = '3000'; protected $car = 'BMW'; private $gf = 'mv'; public function par() { echo $this->money; echo $this->car; echo $this->gf; } } class Stu extends Human { public function sub() { echo $this->money; echo $this->car; echo $this->gf; } } $stu = new Stu; $stu->par(); $stu->sub(); //gf没有被继承 echo $s...
2020年12月28日
895 阅读
0 评论
2020-12-15

PHP批量清空删除文件夹、文件

PHP批量清空删除文件夹、文件
<?php //访问链接如http://localhost/qlhc.php?q=123456 if (!isset($_GET['q']) && $_GET['q'] != '123456') { header("location: //$_SERVER[HTTP_HOST]"); exit(); } // 清文件缓存 $dirs = array( realpath(dirname(__DIR__) . '/cache/index/') ); // 清理缓存 foreach ($dirs as $dir) { doRmdir($dir); echo $dir . " 清理成功!"; } /** * 清空/删除 文件夹 * @param string $dirname 文件夹路径 * @param bool $self 是否删除当前文件夹 * @return bool */ function doRmdir($dirname, $self = true) { ...
2020年12月15日
779 阅读
0 评论
2020-12-15

PHP将动态网页生成HTML纯静态网页

PHP将动态网页生成HTML纯静态网页
<?php start(array( 'index_file' => __DIR__ . '/2.php', //你首页的文件名 'cache_file' => __DIR__ . '/cache/index/', //要缓存的路径 'cache_index_file' => 'index.html', //要缓存的文件名 'expire_seconds' => 43200, //过期的秒数(60秒=1分钟) )); function start($config) { $remain_seconds = $file_timestamp = 0; if (hasCached($config, $remain_seconds, $file_timestamp)) { $html = ''; $html .= file_get_contents($config['cache_file'] . $config['cache_index_file']); die($...
2020年12月15日
817 阅读
0 评论
2020-12-15

PHP动态生成图形验证码

PHP动态生成图形验证码
1.php<?php $w = 80; //设置图片宽和高 $h = 26; $str = array(); //用来存储随机码 $string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; //随机挑选其中4个字符,也可以选择更多,注意循环的时候加上,宽度适当调整 for ($i = 0; $i < 4; $i++) { $str[$i] = $string[rand(0, 35)]; $vcode .= $str[$i]; } session_start(); //启用超全局变量session $_SESSION["vcode"] = $vcode; $im = imagecreatetruecolor($w, $h); $white = imagecolorallocate($im, 255, 255, 255); //第一次调用设置背景色 $black = imagecolorallocate($im, 0, 0,...
2020年12月15日
855 阅读
0 评论
2020-12-12

PHP使用PHPExcel上传下载Excel文件

PHP使用PHPExcel上传下载Excel文件
1、生成Excel并下载<?php include "./PHPExcel-1.8/Classes/PHPExcel/IOFactory.php"; $header = ['表头1','表头2','表头3']; $data = [['数据1','数据2','数据3'],['数据1','数据2','数据3']]; $sheet_name = '数据'; // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set document properties $objPHPExcel->getProperties()->setCreator("Maarten Balliauw") ->setLastModifiedBy("Maarten Balliauw") ->setTitle("Office 2007 XLSX Test Document") ->setSubjec...
2020年12月12日
2,019 阅读
2 评论
2020-12-12

PHP读取Excel文件数据

PHP读取Excel文件数据
github:https://github.com/PHPOffice/PHPExcelPHPExcel下载地址:https://zhizun.lanzoux.com/iK72Wjah4id<?php //引入类库 include "./PHPExcel-1.8/Classes/PHPExcel/IOFactory.php"; //elsx文件路径 $inputFileName = "./tq.xls"; date_default_timezone_set('PRC'); // 读取excel文件 try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch (Exception $e) ...
2020年12月12日
953 阅读
0 评论