php循环显示文件,返回array

php循环显示文件,返回array

//循环显示文件,返回array public static function dirAllFile($dirName) { // global $array; $array = array(); // util::pre_print_r($array); if ($handle = opendir("$...

PHP 2021-02-28 PM 2198次 0条
php循环删除目录和文件函数

php循环删除目录和文件函数

//循环删除目录和文件函数 public static function delDirAndFile($dirName, $delDir = 0) { if ($handle = opendir("$dirName")) { while (false !== ( $item = readdir($h...

PHP 2021-02-28 PM 2179次 0条
php 截取字符串

php 截取字符串

/**$sourcestr 是要处理的字符串$cutlength 为截取的长度(即字数) */static function cut_str($sourcestr, $cutlength, $type = true){$returnstr = ''; $i = 0; $n = 0; $str_length = strlen(trim($sourcestr)); //字符串的字节数 w...

PHP 2021-02-28 PM 2051次 0条
php 下载到本地

php 下载到本地

/**下载到本地 */ static function httpcopy($url, $file = "", $timeout = 600) { if (empty($file)) return false; $dir = pathinfo($file, PATHINFO_DIRNA...

PHP 2021-02-28 PM 2027次 0条
php 判断是否为utf8字符串

php 判断是否为utf8字符串

/** * 判断是否为utf8字符串 * @parem $str * @return bool 180it.com */ function is_utf8($str) { if ($str === mb_convert_encoding(mb_convert_encoding($str, "UTF-32&quo...

PHP 2021-02-28 PM 1948次 0条
php 检查路径是否存在

php 检查路径是否存在

/**检查路径是否存在@parem $path@return bool */function path_exists($path){$pathinfo = pathinfo($path . '/tmp.txt'); if (!empty($pathinfo ['dirname'])) { if (file_exists($pathinfo ['dirname']) === false...

PHP 2021-02-28 PM 1891次 0条
php 写文件

php 写文件

/** * 写文件 */ function put_file($file, $content, $flag = 0) { $pathinfo = pathinfo($file); if (!empty($pathinfo ['dirname'])) { if (file_exists...

PHP 2021-02-28 PM 1889次 0条
php 获得用户的真实IP 地址

php 获得用户的真实IP 地址

/**获得用户的真实IP 地址 *@param 多个用多行分开@return void */public static function get_client_ip(){static $realip = NULL; if (self::$client_ip !== NULL) { return self::$client_ip; } if (isset($_SERVER['HTTP_...

PHP 2021-02-28 PM 2100次 0条
php 获取远程数据

php 获取远程数据

/** * 获取远程数据 * @param $url 地址 * @param $post_data 参数 * @param $method 方法 * @param $timeout 延时 */ function send($url = "", $post_data = '', $method = 'POST', $timeout = 20) { ...

PHP 2021-02-28 PM 2128次 0条
php 封装好得url 跳转

php 封装好得url 跳转

/** * url 跳转 * @param $url 跳转的url * @param $type 跳转类型 301 404 * @param $tip 提示信息 */ function redirect($url = '/', $type = '', $tip = '') { if ($type == '301') { Header('HT...

PHP 2021-02-28 PM 2185次 0条
php 记录日志

php 记录日志

//记录日志 function logs($channel, $contents) { $path = PATH_ROOT . '/data/log/'; if (!is_dir($path)) { if (!@mkdir($path, 0777, true)) { exit("无法创建目录{$path},请检查是否具...

PHP 2021-02-28 PM 2069次 0条