PHP

php上传类(安全上传类)

php上传类(安全上传类)

[php]
<?php
//php文件上传类
//author: lenix 2014.10.7<!--more-->
header("Content-Type:text/html; charset=utf-8");
date_default_timezone_set("Asia/Shanghai");

class UploadFile
{
private $imageType=["image/gif","image/jpeg","image/jpg","image/png","image/x-png","image/bmp","image/x-ms-bmp","image/pjpeg"];//图片类型
private $fileType=["application/zip","application/msexcel","application/xml","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/mspowerpoint","application/vnd.ms-powerpoint","application/pdf","application/x-shockwave-flash","application/x-rar-compressed","application/x-rar","audio/mpeg","audio/x-ms-wma","flv-application/octet-stream","audio/x-ms-wmv","video/mp4","video/x-flv","audio/x-wav","application/msword","video/mpeg"];//文件类型
private $tmpName;
private $fileName;
private $error;
private $fileSize;//上传文件大小
private $maxSize=10000000;//最大允许上传大小
private $upName;
private $upDir="uploadfile/";//上传目录

//构造函数 默认为图片上传
function __construct($upType="image")
{
$this-&gt;tmpName = $_FILES["file"]["tmp_name"];
$this-&gt;fileName …

        

如何面试 PHP 工程师?

在知乎上看到的问题,觉得非常不错,有些东西可以在以后面试过程中参考借鉴下,下面就列一下网友的一些回答:

1、网友 flamingtop 的回答:

问一些日常的正常的PHP问题,主要是考察应聘者的认知:

1)、一个包含中英文的字符串如何获得它的自然长度(看看ta是否有encoding的知识和意识)

2)、问一问什么是ORM,有时候会问这个词的英文全称是什么,问问ta对于ORM有什么个人的看法?(看看ta学习细不细,有没有技术判断,PHP开发人员应该知道什么时候使用ORM)…

mac os 10.9 Mavericks 自带php安装扩展 -by Lenix

mac os 10.9 Mavericks  自带php安装扩展()

安装gmp扩展------------

下载 https://gmplib.org/download/gmp/gmp-5.1.3.tar.bz2,网站https://gmplib.org/

411 cd /Users/yangyanbin/Downloads/gmp-5.1.3; clear; pwd
412 ./configure
413 make
414 make install
下载php源码 http://ar2.php.net/distributions/php-5.4.24.tar.gz,网站http://cn2.php.net/get/php-5.4.24.tar.gz/from/a/mirror…