1,缓存问题
2,在行内元素不能起作用无法作为一个块情况下 加个block -inline
3,网页重定向次数太多,控制器的逻辑问题,继承问题
最近想看看关于提高代码方面的知识,所以就找到了博客,转载了过来,作为笔记
https://blog.csdn.net/a923544197/article/details/7466536
一个关于商家经纬度换算的博客的思路笔记,可以了解一下这个算法
https://www.cnblogs.com/hellyliu/p/4870762.html
php职业规划
基础很重要
http://rango.swoole.com/archives/570
关于laravel 的ioc容器的概念
https://blog.csdn.net/oZuoAZuo/article/details/60955155
关于redis 分布式布置原理
https://blog.csdn.net/yinwenjie/article/details/53672232?utm_source=blogxgwz0
nginx 的基础
https://blog.csdn.net/yinwenjie/article/details/46620711
//比较全面的php设计模式讲解
https://my.oschina.net/botkenni/blog/1603660
//linux 就该这么学 笔记 比较详细的介绍了linux的相关知识
https://blog.csdn.net/valada/article/details/81639730
//关于innodb的四种事务隔离级别?我只知道让我明白了一些名词的原理
https://blog.csdn.net/z50L2O08e2u4afToR9A/article/details/82186189
//关于unix编程,涉及到shell博客
https://www.cnblogs.com/smartxuchao/p/6649981.html
//ngiinx 策略防止ddos 频繁请求
https://blog.csdn.net/u014359108/article/details/50781547
//php RabbitMQ
https://www.cnblogs.com/miketwais/p/RabbitMQ.html
//php kafka
https://blog.csdn.net/weiwenjuan0923/article/details/76152744
//etcd
http://www.cnblogs.com/breg/p/5728237.html
//php zookeeper
https://blog.csdn.net/yanyan42/article/details/81667335
//php + mongodb
https://www.cnblogs.com/lizeyan/p/5315993.html
//商品表设计 参照
http://www.wstmart.net/database-913.html
//PhpStorm 2018 安装及破解方法
https://blog.csdn.net/u012278016/article/details/81772566
//找到一个看云笔记技术博客
https://www.kancloud.cn/xiak/php-node/500076
https://www.cnblogs.com/allcloud/p/7614275.html
//PHP 编译安装时出现 undefined reference to `libiconv' 错误的解决方法
https://blog.csdn.net/dexter_wang/article/details/61616154
//php 配合rabbitMq 文档
https://rabbitmq.shujuwajue.com/tutorials_with_php/[1]Hello_World.html
//配合 php 的一大堆插件工具 在github可以查到
https://github.com/JingwenTian/awesome-php
//关于一个老铁的博客,很有总结的博客
//python 爬虫教程
https://cuiqingcai.com/1052.html
//快速搭建后台
//rabbitMq 中文文档
https://xiaoxiami.gitbook.io/rabbitmq_into_chinese_php/ying-yong-jiao-cheng/php-ban/1-hello_world
//一些有用的课程付费视频
//关于tp3.2 volist 默认选中
<div class="z_select z_border fl z_mr5">
<select name="city" id="city">
<volist name="city_list" id="val">
<eq name="$info.city" value="val.id">
<option value="{$val.id}" selected>{$val.name}</option>
<else />
<option value="{$val.id}" >{$val.name}</option>
</eq>
</volist>
</select>
</div>
//文件下载类
<?php
namespace App\Api;
/**
* 上传文件
* Class UploadApi
* @package App\Api
*/
class DownloadApi extends BaseApi {
var $datasec = array ();
var $ctrl_dir = array ();
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
var $old_offset = 0;
function unix2_dostime($unixtime = 0){
$timearray = ($unixtime == 0) ? getdate () : getdate($unixtime);
if ($timearray ['year'] < 1980){
$timearray ['year'] = 1980;
$timearray ['mon'] = 1;
$timearray ['mday'] = 1;
$timearray ['hours'] = 0;
$timearray ['minutes'] = 0;
$timearray ['seconds'] = 0;
}
return (($timearray ['year'] - 1980) << 25) | ($timearray ['mon'] << 21) | ($timearray ['mday'] << 16) | ($timearray ['hours'] << 11) | ($timearray ['minutes'] << 5) | ($timearray ['seconds'] >> 1);
}
function add_file($data, $name, $time = 0){
$name = str_replace('\\', '/', $name);
$dtime = dechex($this->unix2_dostime($time));
$hexdtime = '\x' . $dtime [6] . $dtime [7] . '\x' . $dtime [4] . $dtime [5] . '\x' . $dtime [2] . $dtime [3] . '\x' . $dtime [0] . $dtime [1];
eval('$hexdtime = "' . $hexdtime . '";');
$fr = "\x50\x4b\x03\x04";
$fr .= "\x14\x00";
$fr .= "\x00\x00";
$fr .= "\x08\x00";
$fr .= $hexdtime;
$unc_len = strlen($data);
$crc = crc32($data);
$zdata = gzcompress($data);
$zdata = substr(substr($zdata, 0, strlen($zdata)- 4), 2);
$c_len = strlen($zdata);
$fr .= pack('V', $crc);
$fr .= pack('V', $c_len);
$fr .= pack('V', $unc_len);
$fr .= pack('v', strlen($name));
$fr .= pack('v', 0);
$fr .= $name;
$fr .= $zdata;
$fr .= pack('V', $crc);
$fr .= pack('V', $c_len);
$fr .= pack('V', $unc_len);
$this->datasec [] = $fr;
$cdrec = "\x50\x4b\x01\x02";
$cdrec .= "\x00\x00";
$cdrec .= "\x14\x00";
$cdrec .= "\x00\x00";
$cdrec .= "\x08\x00";
$cdrec .= $hexdtime;
$cdrec .= pack('V', $crc);
$cdrec .= pack('V', $c_len);
$cdrec .= pack('V', $unc_len);
$cdrec .= pack('v', strlen($name));
$cdrec .= pack('v', 0);
$cdrec .= pack('v', 0);
$cdrec .= pack('v', 0);
$cdrec .= pack('v', 0);
$cdrec .= pack('V', 32);
$cdrec .= pack('V', $this->old_offset);
$this->old_offset += strlen($fr);
$cdrec .= $name;
$this->ctrl_dir[] = $cdrec;
}
function add_path($path, $l = 0){
$d = @opendir($path);
$l = $l > 0 ? $l : strlen($path) + 1;
while($v = @readdir($d)){
if($v == '.' || $v == '..'){
continue;
}
$v = $path . '/' . $v;
if(is_dir($v)){
$this->add_path($v, $l);
} else {
$this->add_file(file_get_contents($v), substr($v, $l));
}
}
}
function file(){
$data = implode('', $this->datasec);
$ctrldir = implode('', $this->ctrl_dir);
return $data . $ctrldir . $this->eof_ctrl_dir . pack('v', sizeof($this->ctrl_dir)) . pack('v', sizeof($this->ctrl_dir)) . pack('V', strlen($ctrldir)) . pack('V', strlen($data)) . "\x00\x00";
}
function add_files($files){
foreach($files as $file){
if (is_file($file)){
$data = implode("", file($file));
$this->add_file($data, $file);
}
}
}
function output($file){
$fp = fopen($file, "w");
fwrite($fp, $this->file ());
fclose($fp);
}
}
文件目录打包压缩处理
<?php
date_default_timezone_set('PRC'); //设置中国时区
##################### 开始处理文件 #########################
//目录
$base_dir = '../logger/';
$res1 = empty_dir($base_dir);
if ($res1 === false) {
exit;
}
//创建临时目录
$create_dir = iconv("UTF-8", "GBK", "../".date("Ymd"));
if (!file_exists($create_dir)){
mkdir ($create_dir,0777,true);
}
$dir = opendir($base_dir);
while ($flist = readdir($dir)) {
$base_f = $base_dir .$flist;
if ($flist == '.' || $flist == '..') {
} else {
$filename = scandir($base_f. '/');
deal_file($base_f, $filename, $create_dir);
}
}
@closedir($base_dir);
//生成压缩文件
$zip = new ZipFolder;
$now_tmp = '../'.date("Ymd").'.zip';
$a = $zip->zip($now_tmp, $create_dir);
//发送压缩文件
if ($a === true) {
$url = 'http://www.baidu.com';
curl_post($url, $now_tmp);
//发送文件完成 删除临时文件夹
deldir($create_dir);
}
##################### 文件处理结束 #########################
//处理并且移动临时文件
function deal_file ($base_f, $filename, $create_dir)
{
$hour = date("H");
$i = 0;
foreach ($filename as $key => $value) {
$tmp = date('Ymd').'_'.date('Ymd').'_'.$hour.'_'.$i.'.log';
if ($value == '.' || $value == '..') {
} else {
$i++;
//复制文件到临时目录
$file = explode('.', $value);
//如果当前的文件夹是
if($file[0] == $hour) {
copy($base_f.'/'.$value, $create_dir. '/'. $tmp);
}
}
}
}
//创建文件夹
function create_dir ()
{
}
//移动之后 删除文件夹
function deldir($dir) {
//先删除目录下的文件:
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
closedir($dh);
//删除当前文件夹:
if(rmdir($dir)) {
return true;
} else {
return false;
}
}
//curl post 发送文件
function curl_post($url, $data) {
//初使化init方法
$ch = curl_init();
//指定URL
curl_setopt($ch, CURLOPT_URL, $url);
//设定请求后返回结果
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//声明使用POST方式来进行发送
curl_setopt($ch, CURLOPT_POST, 1);
//发送什么数据呢
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//忽略证书
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//忽略header头信息
curl_setopt($ch, CURLOPT_HEADER, 0);
//设置超时时间
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
//发送请求
$output = curl_exec($ch);
//关闭curl
curl_close($ch);
//返回数据
return $output;
}
//判断是否为空文件夹
function empty_dir ($base_dir)
{
if (!is_dir($base_dir)) {
return false;
}
$dir = opendir($base_dir);
$i = 0;
while ($flist = readdir($dir)) {
$i++;
}
//判断前面的文件是否为空
if ($i < 3) {
return false;
}
return $i;
}
class ZipFolder
{
protected $zip;
protected $root;
protected $ignored_names;
public function __construct(){
$this->zip = new ZipArchive;
}
/**
* 解压zip文件到指定文件夹
*
* @access public
* @param string $zipfile 压缩文件路径
* @param string $path 压缩包解压到的目标路径
* @return booleam 解压成功返回 true 否则返回 false
*/
public function unzip ($zipfile, $path) {
if ($this->zip->open($zipfile) === true) {
$file_tmp = @fopen($zipfile, "rb");
$bin = fread($file_tmp, 15); //只读15字节 各个不同文件类型,头信息不一样。
fclose($file_tmp);
/* 只针对zip的压缩包进行处理 */
if (true === $this->getTypeList($bin))
{
$result = $this->zip->extractTo($path);
$this->zip->close();
return $result;
}
else
{
return false;
}
}
return false;
}
/**
* 创建压缩文件
*
* @access public
* @param string $zipfile 将要生成的压缩文件路径
* @param strng $folder 将要被压缩的文件夹路径
* @param array $ignored 要忽略的文件列表
* @return booleam 压缩包生成成功返回true 否则返回 false
*/
public function zip ($zipfile, $folder, $ignored = null) {
$this->ignored_names = is_array($ignored) ? $ignored : $ignored ? array($ignored) : array();
if ($this->zip->open($zipfile, ZIPARCHIVE::CREATE) !== true) {
throw new Exception("cannot open <$zipfile>\n");
}
$folder = substr($folder, -1) == '/' ? substr($folder, 0, strlen($folder)-1) : $folder;
if(strstr($folder, '/')) {
$this->root = substr($folder, 0, strrpos($folder, '/')+1);
$folder = substr($folder, strrpos($folder, '/')+1);
}
$this->createZip($folder);
return $this->zip->close();
}
/**
* 递归添加文件到压缩包
*
* @access private
* @param string $folder 添加到压缩包的文件夹路径
* @param string $parent 添加到压缩包的文件夹上级路径
* @return void
*/
private function createZip ($folder, $parent=null) {
$full_path = $this->root . $parent . $folder;
$zip_path = $parent . $folder;
$this->zip->addEmptyDir($zip_path);
$dir = new DirectoryIterator($full_path);
foreach($dir as $file) {
if(!$file->isDot()) {
$filename = $file->getFilename();
if(!in_array($filename, $this->ignored_names)) {
if($file->isDir()) {
$this->createZip($filename, $zip_path.'/');
}else {
$this->zip->addFile($full_path.'/'.$filename, $zip_path.'/'.$filename);
}
}
}
}
}
/**
* 读取压缩包文件与目录列表
*
* @access public
* @param string $zipfile 压缩包文件
* @return array 文件与目录列表
*/
public function fileList($zipfile) {
$file_dir_list = array();
$file_list = array();
if ($this->zip->open($zipfile) == true) {
for ($i = 0; $i < $this->zip->numFiles; $i++) {
$numfiles = $this->zip->getNameIndex($i);
if (preg_match('/\/$/i', $numfiles))
{
$file_dir_list[] = $numfiles;
}
else
{
$file_list[] = $numfiles;
}
}
}
return array('files'=>$file_list, 'dirs'=>$file_dir_list);
}
/**
* 得到文件头与文件类型映射表
*
* @author wengxianhu
* @date 2013-08-10
* @param $bin string 文件的二进制前一段字符
* @return boolean
*/
private function getTypeList ($bin)
{
$array = array(
array("504B0304", "zip")
);
foreach ($array as $v)
{
$blen = strlen(pack("H*", $v[0])); //得到文件头标记字节数
$tbin = substr($bin, 0, intval($blen)); ///需要比较文件头长度
if(strtolower($v[0]) == strtolower(array_shift(unpack("H*", $tbin))))
{
return true;
}
}
return false;
}
}