欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

php

shiping1 的头像

php fread 有大用

fread

(PHP 4, PHP 5)

普通分类: 
shiping1 的头像

php 下载 打开 文件 图片 图像 有大用 有大大用 有大大大用

1)下载
<?php

/**
 * download page
 *
 * @author  shipingzhong <shipingzhong@altech-it.cn>
 * @version 20090525
 */
 
session_cache_limiter("public"); // for IE

// read user common file
//include this file.... and it has smarty function
require_once("./include/User.inc.php");
   
$uid = $_SESSION['sess_marry_user']['user_id'];
$wid = $_SESSION['sess_marry_user']['wedding_id'];

普通分类: 
shiping1 的头像

thinkphp 清空缓存

一般 后台都有清空缓存的按扭

ThinkPHP清除缓存

ThinkPHP需要清除的缓冲有四个:模版缓存(Cache),数据缓存目录(Temp), 日志目录(Logs), 数据目录(Data)。

普通分类: 
shiping1 的头像

thinkphp新增字段无法插入到数据库是因为fields字段缓存

thinkphp > thinkphp新增字段无法插入到数据库是因为fields字段缓存
2010十一月26

thinkphp新增字段无法插入到数据库是因为fields字段缓存

普通分类: 
shiping1 的头像

PHP生成随机字符串的三种方法

PHP生成随机字符串的三种方法

2010-09-02 10:02 Ludou 毛蛋网 字号:T | T
一键收藏,随时查看,分享好友!

使用PHP开发应用程序,尤其是网站程序,常常需要生成随机密码,而本文收集整理了几种生成随机字符串的方法,希望对您有所帮助。

普通分类: 
shiping1 的头像

php include path

php设置include路径的方法

有两种方法来设置php的include_path.

一:修改php.ini文件中的include_path项。

例:include_path = .:/usr/local/lib/php:./include

二:使用ini_set方法(对于无法修改php.ini的情况)。

例:ini_set("include_path", ".:../:./include:../include

 

include_path补充

普通分类: 
shiping1 的头像

php去除字符串首尾中英文空格

  1. /** 
  2.  * 去除空格(包括中英文空格) 
  3.  * User: yangyingjie 
  4.  * qq: 471156231  
  5.  */  
  6. function  mbTrim($str)  
  7. {  
  8.     return mb_ereg_replace('(^( | )+|( | )+$)'''
普通分类: 
shiping1 的头像

makehtml_map.php 通过 plus/sitemap.htm生成静态文件

makehtml_map.php 通过 plus/sitemap.htm生成静态文件
在sitemap.htm里不认识 许多标签 比如不认识{dede:type typeid}
这个我标签  我们可以在sitemap.htm里包含一下 aaaa.htm
然后在 aaaa.htm里面使用这个标签
普通分类: 
shiping1 的头像

php 换行符 回车符

windows \r\n \r为回车符
linux \n

$arr = explode("\n",$Str);
把双引号写成单引号是不行的哦.


袁绍锋的正确做法
$oneVod['vod_urls'] = array();
$oneVod['vod_url'] = str_replace("\n",'',$oneVod['vod_url']);
$oneVod['vod_urls'] = explode("\r",$oneVod['vod_url']);
普通分类: 
shiping1 的头像

PHP String 函数 字符串函数 有大用 有大大用 有大大大用

PHP String 函数

普通分类: 
shiping1 的头像

str_replace 被替换的可以为数组 也可以为串

function safe_func($str){
    //$vowels = array("/", "\\","!","@","#","$","%","^","&","*",'<','>');
    $vowels = array("\\","!","@","#","$","%","^","&","*",'<','>');
    $str = str_replace($vowels, "", $str);
    empty($str) && $str='';
    return $str;
}
普通分类: 
shiping1 的头像

PHP strip_tags() 函数

PHP strip_tags() 函数

定义和用法

strip_tags() 函数剥去 HTML、XML 以及 PHP 的标签。

语法

strip_tags(string,allow)
参数描述
string必需。规定要检查的字符串。
allow可选。规定允许的标签。这些标签不会被删除。

提示和注释

注释:该函数始终会剥离 HTML 注释。这点无法通过 allow 参数改变。

普通分类: 
shiping1 的头像

ThinkPHP函数详解:F方法

ThinkPHP函数详解:F方法

 
浏览:6313 发布日期:2013/06/03 分类:文档教程 关键字: 函数 F方法
我们已经了解了ThinkPHP中的S方法的用法,F方法其实是S方法的一个子集功能,仅用于简单数据缓存,并且只能支持文件形式,不支持缓存有效期,因为采用的是PHP返回方式,所以其效率较S方法较高,因此我们也称之为快速缓存方法。
F方法的特点是:
简单数据缓存;
文件形式保存;
采用PHP返回数据方式加载缓存;
支持子目录缓存以及自动创建;
支持删除缓存和批量删除;
普通分类: 
shiping1 的头像

thinkphp学习

http://www.5idev.com/p-thinkphp_intro.shtml

ThinkPHP 是什么?

ThinkPHP 简介

ThinkPHP 简介

ThinkPHP 是一个免费开源的,快速、简单的面向对象的国产轻量级 PHP 开发框架。

普通分类: 
shiping1 的头像

PHP parse_str() 函数

PHP parse_str() 函数

普通分类: 
shiping1 的头像

php rand 随机数

PHP rand() 函数

定义和用法

rand() 函数返回随机整数。

语法

rand(min,max)
参数描述
min,max可选。规定随机数产生的范围。

说明

如果没有提供可选参数 minmax,rand() 返回 0 到 RAND_MAX 之间的伪随机整数。例如,想要 5 到 15(包括 5 和 15)之间的随机数,用 rand(5, 15)。

普通分类: 
shiping1 的头像

PHP去除回车换行符

PHP去除回车换行符

preg_replace("'([\r\n])[\s]+'", "", $content) //去除回车换行符

普通分类: 
shiping1 的头像

str_replace

$vowels = array("\\", "'", "\"");
    $str = str_replace($vowels, "", $str);
普通分类: 
shiping1 的头像

php 转码函数 转码 转换编码

php 转码函数 你还在用iconv吗?

 

在使用PHP处理字符串时,我们经常会碰到字符编码转换的问题,你碰到过iconv转换失败吗?

发现问题时,网上搜了搜,才发现iconv原来有bug ,碰到一些生僻字就会无法转换,当然了配置第二个参数时,可以稍微弥补一下默认缺陷,不至于无法转换是截断,用法如下

普通分类: 
shiping1 的头像

列出目录下面的文件 及子目录下面的文件

<?php
set_time_limit(0);
function showDir($dir)
{
    
     $handleSub = @opendir($dir) or die("Cannot open " . $dir);
     while($file = readdir($handleSub))
     {
             if($file != "." && $file != ".."  )
             {
                  echo "<a href='./{$file}' target='_blank' >{$dir}/{$file} \t\n</a><br/>";
                  
                  $full = "{$dir}/{$file}";
                  if(is_dir($full)){
                      showDir($full);
                  }
普通分类: 
shiping1 的头像

@隐藏错误

 if (@$_POST['user1']!='')
  {
      $rand = rand(0,99)%2;
      if($rand==0){
          echo "哈哈,你好,".$_POST['user1'].'你来干活!';
      }
      else{
          echo "哈哈,你好,".$_POST['user2'].'你来干活!';
          
      }
    
普通分类: 
shiping1 的头像

深入学习PHP数组删除元素方法 数组元素移除

深入学习PHP数组删除元素方法

2009-11-16 16:31 佚名 博客 我要评论(0) 字号:T | T
一键收藏,随时查看,分享好友!

我们使用unset()函数解决PHP数组删除的问题

普通分类: 
shiping1 的头像

php常量

<语法
[edit] Last updated: Fri, 11 Oct 2013

view this page in

普通分类: 
shiping1 的头像

PHP获取当前页面的URL

 

普通分类: 
shiping1 的头像

php 字符串长度

1)在utf8的情况下 根据参数 ,中文算一个 英文算一个     或者一个中文算两个,英文算一个
header('Content-type:text/html;charset=utf-8');
/**
* 可以统计中文字符串长度的函数
* @param $
普通分类: 
shiping1 的头像

php 判断字符串是否存在 是否包含 有大用

<?php
/*
判断字符串是否存在的函数
*/

//下面结果返回真 就是包含

//strpos(整个串,部分串,偏移位置)

//第一个参数是整个串 第二个参数是部分串
function strexists($haystack, $needle) {
return !(strpos($haystack, $needle) === FALSE);//注意这里的"==="
}

?>

普通分类: 
shiping1 的头像

php 字符串 以什么开头 开头开始 以什么结尾 结束 包含 startWith endWith _startWith _endWith _start_With _end_With 字符串 包含存在 有大用 有大大用 有大大大用

//第一个是原串,第二个是 部份串

function _baohan($str, $needle){
  return stripos($str,$needle)!== false;
}

//第一个是原串,第二个是 部份串    startWith

function _startWith($str, $needle) {

    return strpos($str, $needle) === 0;

}

普通分类: 
shiping1 的头像

php urlencode编码,urldecode解码 base64_encode base64_decode

PHP解决网址URL编码问题的函数urlencode()、urldecode()、rawurlencode()、rawurldecode()

阅读文字大小:【小】   【大】

在PHP中有urlencode()、urldecode()、rawurlencode()、rawurldecode()这些函数来解决网页URL编码解码问题。

理解urlencode:

普通分类: 
shiping1 的头像

php curl_setopt 有大用

curl_setopt

(PHP 4 >= 4.0.2, PHP 5)

curl_setopt设置一个cURL传输选项

普通分类: 
shiping1 的头像

Fatal error: Call to undefined function curl_init()

1)phpinfo看下
或者
function_exists()下
看是否已经支持CURL

2)如果没有, 到php.ini 把  extension=php_curl.dll 前面注释地分号去掉

3)重启apache

普通分类: 

页面

Subscribe to RSS - php