Coder Social home page Coder Social logo

php_function's Introduction

php_-

run.php里面的代码

php多进程只能在cli模式下运行

父进程创建出来的子进程pid是连续的,创建一定数量的进程,让每个进程处理不同的任务:比如可以读取数据库的一大批数据,通过id来分批给不同的子进程处理。

多进程编程的时候主要是注意并发,不能让不同的进程处理同一个任务。

另外,对于多进程处理数据,网上还有的解决方案是通过redis的队列,没有具体实践过。

function.php php的一些常用方法:

1.全局的安全过滤函数 过滤html js 代码

2.用正则过滤所有空白符

3.字符串截取,支持中文和其他编码

4.加密解密方法,支持过期时间

5.对查询结果集进行排序

6.格式化字节大小

7.时间戳格式化

8.基于数组创建目录和文件

9.阿拉伯数字转中文表述,如101转成一百零一

10.日期转换成星期几

11.获取随机的字符串,用于token,EncodingAESKey等的生成

12.根据两点间的经纬度计算距离

13.判断是否为微信浏览器

  1. 把用户输入的文本转义(主要针对特殊符号和emoji表情)

15.解码上面的转义

16.用curl获取页面内容 GetPageContent

17.文件上传 upload_file

util.php

1.文件锁,加锁/解锁

2.秒数转 X时X分X秒

3.获取文件行数

4.获得当前使用内存

5.获得最高使用内存

  1. 转换大小单位

7.获取数组大小

8.数字随机数

9.字母数字混合随机数

10.汉字转拼音

11.生成字母前缀

12.获得某天前的时间戳

13.读文件

14.写文件,如果文件目录不存在,则递归生成

15.检查路径是否存在,不存在则递归生成路径

16.递归删除目录

17.递归修改目录权限

18.数组格式化为CSV

  1. 判断是否为utf8字符串

20.从普通时间返回Linux时间截(strtotime中文处理版)

21.获取文件后缀名

22.获取 Url 跳转后的真实地址

23.解压服务器用 Content-Encoding:gzip 压缩过的数据

24.数字金额转换为中文

25.colorize 文字带颜色输出

26.获取远程文件的大小

27.下载文件

28.将内容进行UNICODE编码

29.将UNICODE编码后的内容进行解码

30.utf8字符转换成Unicode字符

31.Unicode字符转换成utf8字符

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.