if ( !function_exists('json_decode') ){
function json_decode($json)
{
    $comment = false;
    $out = '$x=';
 
    for ($i=0; $i<strlen($json); $i++)
    {
        if (!$comment)
    ...

阅读全文>>

ftp服务器连接失败,错误提示:
500 OOPS: cannot change directory:/home/*******
500 OOPS: child died


解决方法:

1 在终端输入命令:
setsebool ftpd_disable_trans 1
service vsftpd restart

就OK了!但是下次重启了还会这样··

2 在终端输入命令:

setsebool -P ftpd...

阅读全文>>

官网地址:http://jquery.com/demo/thickbox/

 

用法就是如下了:

<html>
<head>
<script type="text/javascript" src="jquery-latest.js"></script>
<script type="text/javascript" src=...

阅读全文>>

2012-1-30 18:38 Monday  

当在php.ini中开启extension=php_mssql.dll及extension=php_pdo_mssql.dll,重启服务器 后在phpinfo()中还是没有mssql扩展,这时候需要将以上两个dll文件级php5nsapi.dll复制到 c:\windows\system32下面,或者将 php   php/ext 加入到系统环境变量中即可。。

 

MMD...

阅读全文>>

我这种方式是在PHP中生成的,不是直接改html代码的方式,直接改代码的话请自行百度或是用我的方式做好后再在浏览器中查看。

1.将ckfinder放到合适的目录,比如ckeditor下面。

2.修改ckfinder下的config.php中的第33行,将return false;改为 return true;

3.配置ckeditor

一般对于这种常用到的东西,我都会整合成函数

function ckedi...

阅读全文>>

2012-1-30 18:36 Monday  

今天尝试了下面的方法,原来也可以

{$smarty.get.start|default:$smarty.now-7*86400|date_format:"%Y-%m-%d"}

阅读全文>>

convert(text,content)

修改php.ini ,去掉前面的;,将那个4096改大即可。
[MSSQL]
mssql.textlimit   =   4096

//以下度娘

PHP在查询MSSQL数据库的text字段的内容时,如果内容长度过长,则会有部分内容被截取。这也许并不是我们想要的结果,解决办法:

1、修改php.ini文件

打开php.ini文件,查找...

阅读全文>>

2012-1-30 18:35 Monday  

Js

function showbatchbuy(pid){
    $("#p"+pid).show();
    clearTimeout(batchbuy);
}

function hidebatchbuy(pid){
    batchbuy = setTimeout(function(){
        $("#p"+pid).hide();
    },500);
}

触发的

onmouseover="showbatchbuy({$item.id});" onmouseout="hidebatchbuy({$item.id});"

层上面的

onmousemove="showbatchbuy({$item.id});" onmouseout="hidebatchbuy({$item.id});"

2012-1-30 18:35 Monday  
function checkSelect() {

var flag = 0;

$("input[name='edit[]']:checkbox").each(function () {

    if ($(this).attr("checked")) {

        flag += 1;

    }

})

if (flag > 0)

return true;

else{

alert('没有选中一个');

return false;

}

}

解决方案,两次urlencode关键词即可。

阅读全文>>

转载的

在写css的时候经常会碰到你给ul设置了背景色但是却显示不出来的问题,这个问题在不同的浏览器中显示的也不尽相同,比如ie7只显示一部分而 firefox却完全不显示背景色。这个问题好在是比较好解决并且解决的方法也是比较多的,好了多余的话就不再说了下面我列出解决的方法:

1.设置ul的高度或者是宽度均可,并且不需要确定值,随便都可以。

2.ul也设置float

3.ul里设置zoom:1

4.ul设置overflow:hidden也可以但是不兼容IE6

5.这里新增加一个div用clear属性好像在IE6/7中没有效果?FF中可以实现!

升级到smarty3.0后,发现原来的 $smarty->register_function("dealstr","dealstr");已经不能用了,查看了一下手册,发现了如下两种解决方法,以添加函数 dealstr为例:

一、在plugins文件夹下放一个 function.dealstr.php的文件,内容如下

<?php

function smarty_function_deal($param){

extract($param);

//此处省略N个字

}

 

二、直接在一个已引include的文件中将上面定义的函数添加上去即可。

2012-1-30 18:32 Monday  
<?php
/**
 * 很考眼力的验证码
 * @author Aboc QQ:9986584
 */
header("Content-type: image/gif");
session_start();
$im = imagecreate(60, 25);
$bgcolor = imagecolorallocate($im, rand(150, 255),rand(150, 255), rand(150, 255));
imagefill($im, 0, 0, $bgcolor);
$str = "ABCDEFGHIJKLMNPQRSTUVWXYacdefghijkmnpqrstuvwxy3456789";
$strlength = strlen($str)-1;
$s = $str[mt_rand(0, $strlength)].$str[mt_rand(0, $strlength)].$str[mt_rand(0, $strlength)].$str[mt_rand(0, $strlength)];
$t = array();
$t[1] = imagecolorallocate($im, rand(0, 150), rand(0, 150), rand(0, 150));
$t[2] = imagecolorallocate($im, rand(0, 150), rand(0, 150), rand(0, 150));
$t[3] = imagecolorallocate($im, rand(0, 150), rand(0, 150), rand(0, 150));
$t[4] = imagecolorallocate($im, rand(0, 150), rand(0, 150), rand(0, 150));
imagestring($im, 5, rand(0,7), rand(0,8), $s[0], $t[1]);
imagestring($im, 5, rand(13,22), rand(0,8), $s[1], $t[2]);
imagestring($im, 5, rand(28,37), rand(0,8), $s[2], $t[3]);
imagestring($im, 5, rand(43,50), rand(0,8), $s[3], $t[4]);
$c = array();
for ($i=1;$i<=20;$i++){
    $cl = imagecolorallocate($im, rand(220, 255), rand(220, 255), rand(220, 255));
    $x = rand(0,60);
    $y = rand(0,25);
    imageline($im, $x, $y, $x+rand(-3,3), $y+rand(-2,2), $t[1]);
}
$_SESSION['water'] = $s;
unset($s);
unset($t);
unset($cl);
imagegif($im);
imagedestroy($im);

2012-1-30 18:31 Monday  
usleep() 函数延迟代码执行若干微秒。

  unpack() 函数从二进制字符串对数据进行解包。

  uniqid() 函数基于以微秒计的当前时间,生成一个唯一的 ID。

  time_sleep_until() 函数延迟代码执行直到指定的时间。

  PHP5常用函数之time_nanosleep() 函数延迟代码执行若干秒和纳秒。

  sleep() 函数延迟代码执行若干秒。

  show_source() 函数对文件进行语法高亮显示。

  strip_whitespace() 函数返回已删除 PHP 注释以及空白字符的源代码文件。

  pack() 函数把数据装入一个二进制字符串。

  ignore_user_abort() 函数设置与客户机断开是否会终止脚本的执行。

  highlight_string() 函数对字符串进行语法高亮显示。

  highlight_file() 函数对文件进行语法高亮显示。

  PHP5常用函数之get_browser() 函数返回用户浏览器的性能。

  exit() 函数输出一条消息,并退出当前脚本。

  eval() 函数把字符串按照 PHP 代码来计算。

  die() 函数输出一条消息,并退出当前脚本。

  defined() 函数检查某常量是否存在。

  define() 函数定义一个常量。

  constant() 函数返回常量的值。

  PHP5常用函数之connection_status() 函数返回当前的连接状态。

  connection_aborted() 函数检查是否断开客户机。

  zip_read() 函数读取打开的 zip 档案中的下一个文件。

  zip_open() 函数打开 ZIP 文件以供读取。

  zip_entry_read() 函数从打开的 zip 档案项目中获取内容。

  zip_entry_open() 函数打开一个 ZIP 档案项目以供读取。

  PHP5常用函数之zip_entry_name() 函数返回 zip 档案项目的名称。

  zip_entry_filesize() 函数返回 zip 档案项目的原始大小(在压缩之前)。

  zip_entry_compressionmethod() 函数返回 zip 档案项目的压缩方法。

  zip_entry_compressedsize() 函数返回 zip 档案项目的压缩文件尺寸。

  zip_entry_close() 函数关闭由 zip_entry_open() 函数打开的 zip 档案文件。

  zip_close() 函数关闭由 zip_open() 函数打开的 zip 档案文件。

  xml_set_unparsed_entity_decl_handler() 函数规定在遇到无法解析的实体名称(NDATA)声明时被调用的函数。

  xml_set_processing_instruction_handler() 函数规定当解析器在 XML 文档中找到处理指令时所调用的函数。

  xml_set_object() 函数允许在对象中使用 XML 解析器。

  PHP5常用函数之xml_set_notation_decl_handler() 函数规定当解析器在 XML 文档中找到符号声明时被调用的函数。

  xml_set_external_entity_ref_handler() 函数规定当解析器在 XML 文档中找到外部实体时被调用的函数。

  xml_set_element_handler() 函数建立起始和终止元素处理器。

  xml_set_default_handler() 函数为 XML 解析器建立默认的数据处理器。

  xml_set_character_data_handler() 函数建立字符数据处理器。

  xml_parser_set_option() 函数为 XML 解析器进行选项设置。

  xml_parser_get_option() 函数从 XML 解析器获取选项设置信息。

  xml_parser_free() 函数释放 XML 解析器。

  PHP5常用函数之xml_parser_create() 函数创建 XML 解析器。

  xml_parser_create_ns() 函数创建带有命名空间支持的 XML 解析器。

  xml_parse_into_struct() 函数把 XML 数据解析到数组中。

  xml_parse() 函数解析 XML 文档。

  xml_get_error_code() 函数获取 XML 解析器错误代码。

  xml_get_current_line_number() 函数获取 XML 解析器的当前行号。

  xml_get_current_column_number() 函数获取 XML 解析器的当前列号。

  PHP5常用函数之xml_get_current_byte_index() 函数获取 XML 解析器的当前字节索引。

  xml_error_string() 函数获取 XML 解析器的错误描述。

  utf8_encode() 函数把 ISO-8859-1 字符串编码为 UTF-8。

  utf8_decode() 函数把 UTF-8 字符串解码为 ISO-8859-1。

  wordwrap() 函数按照指定长度对字符串进行折行处理。

  vsprintf() 函数把格式化字符串写入变量中。

  vprintf() 函数输出格式化的字符串。

  vfprintf() 函数把格式化的字符串写到指定的输出流。

  PHP5常用函数之ucwords() 函数把字符串中每个单词的首字符转换为大写。

  ucfirst() 函数把字符串中的首字符转换为大写。

  trim() 函数从字符串的两端删除空白字符和其他预定义字符。

  substr_replace() 函数把字符串的一部分替换为另一个字符串。

  substr_count() 函数计算子串在字符串中出现的次数。

  substr_compare() 函数从指定的开始长度比较两个字符串。

  substr() 函数返回字符串的一部分。

  strtr() 函数转换字符串中特定的字符。

  strtoupper() 函数把字符串转换为大写。

  strtolower() 函数把字符串转换为小写。

  PHP5常用函数之strtok() 函数把字符串分割为更小的字符串。

  strstr() 函数搜索一个字符串在另一个字符串中的第一次出现。

  strspn() 函数返回在字符串中包含的特定字符的数目。

  strrpos() 函数查找字符串在另一个字符串中最后一次出现的位置。

  strripos() 函数查找字符串在另一个字符串中最后一次出现的位置。

  strrev() 函数反转字符串。

  strrchr() 函数查找字符串在另一个字符串中最后一次出现的位置,并返回从该位置到字符串结尾的所有字符。

  strpos() 函数返回字符串在另一个字符串中第一次出现的位置。

  PHP5常用函数之strpbrk() 函数在字符串中搜索指定字符中的任意一个。

  strncmp() 函数比较两个字符串。

  strncasecmp() 函数比较两个字符串。

  strnatcmp() 函数使用一种“自然”算法来比较两个字符串。

  strnatcasecmp() 函数使用一种“自然”算法来比较两个字符串。

  strlen() 函数返回字符串的长度。

  stristr() 函数查找字符串在另一个字符串中第一次出现的位置。

  stripos() 函数返回字符串在另一个字符串中第一次出现的位置。

  stripslashes() 函数删除由 addslashes() 函数添加的反斜杠。

  stripcslashes() 函数删除由 addcslashes() 函数添加的反斜杠。

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

  strcspn() 函数返回在找到任何指定的字符之前,在字符串查找的字符数。

  PHP5常用函数之strcoll() 函数比较两个字符串。

  strcmp() 函数比较两个字符串。

  strchr() 函数搜索一个字符串在另一个字符串中的第一次出现。

  strcasecmp() 函数比较两个字符串。

  str_word_count() 函数计算字符串中的单词数。

  str_split() 函数把字符串分割到数组中。

  str_shuffle() 函数随机地打乱字符串中的所有字符。

  str_rot13() 函数对字符串执行 ROT13 编码。

  str_replace() 函数使用一个字符串替换字符串中的另一些字符。

  str_repeat() 函数把字符串重复指定的次数。

  str_pad() 函数把字符串填充为指定的长度。

  str_ireplace() 函数使用一个字符串替换字符串中的另一些字符。

  PHP5常用函数之sscanf() 函数根据指定的格式解析来自一个字符串的输入。

  sprintf() 函数把格式化的字符串写写入一个变量中。

  soundex() 函数计算字符串的 soundex 键。

  similar_text() 函数计算两个字符串的匹配字符的数目。

  sha1_file() 函数计算文件的 SHA-1 散列。

  sha1() 函数计算字符串的 SHA-1 散列。

  setlocale() 函数设置地区信息(地域信息)。

  PHP5常用函数之rtrim() P rtrim() 函数

2012-1-30 18:31 Monday  

在网上搜索了很多关于ffmpeg-php的文章。大部分都是在linux下配置的文章。介绍window配置的内容相当的少,通过自己努力终于在windows下配置成功。特写下文章希望对大家做视频开发有用。

首先介绍下我使用的集成环境wamp。

PHP: php5.2.6

Apache: apache2.2.8

1.下载ffmpeg-php:http://sergey89.ru/files/ffmpeg-php-win32-all.zip

2. 解压ffmpeg-php-win32-all.zip 后有下面几个文件:

     avcodec-51.dll

     avformat-51.dll

     avutil-49.dll

     php_ffmpeg.dll

     pthreadGC2.dll

3. 将四个文件拷贝到windows\system32文件夹下面(小插曲:之前自己再配置时候按照网上的文章只拷贝两个文件 avcodec-51.dll, avformat-51.dll到这个文件,结果发现并不能配置成功。后来将后面avutil-49.dll, pthreadGC2.dll全部拷贝过去就成功了,很有可能这四个文件是有一定关联使用的。)

     avcodec-51.dll, avformat-51.dll, avutil-49.dll, pthreadGC2.dll

4. 然后需要到apache\bin文件下找到php.ini文件下允许使用dll文件加入extension=php_ffmpeg.dll 并允许     extension=php_gd2.dll, extension=php_gettext.dll这两个
改动后如下(去掉前面的分号就代表允许执行)

    extension=php_gd2.dll
    extension=php_gettext.dll
    extension=php_ffmpeg.dll

5. 重新启动wamp后使用phpinfo()函数看到一下信息配置:   //我两个环境一个apache一个IIS,iis不用重启就生效了,apache没试不知道, add by aboc

ffmpeg


ffmpeg-php version 0.5.2.1
libavcodec version Lavc51.43.0
libavformat version Lavf51.12.2
ffmpeg-php gd support enabled

 以上就表明ffmpeg在php环境中配置成功了。

6. 下面我们建立一个php的页面来测试是不是可以使用ffmpeg的一些函数功能。建立testvideo.php文件

 代码如下:

<?php

extension_loaded('ffmpeg');  //可不要

$ffmpegInstance = new ffmpeg_movie('C:\wamp\www\top10.mp4'); //这里要用绝对路径
echo "getDuration: " . $ffmpegInstance->getDuration()."<br>" .
"getFrameCount: " . $ffmpegInstance->getFrameCount()."<br>" .
"getFrameRate: " . $ffmpegInstance->getFrameRate()."<br>" .
"getFilename: " . $ffmpegInstance->getFilename()."<br>" .
"getComment: " . $ffmpegInstance->getComment()."<br>" .
"getTitle: " . $ffmpegInstance->getTitle()."<br>" .
"getAuthor: " . $ffmpegInstance->getAuthor()."<br>" .
"getCopyright: " . $ffmpegInstance->getCopyright()."<br>" .
"getArtist: " . $ffmpegInstance->getArtist()."<br>" .
"getGenre: " . $ffmpegInstance->getGenre()."<br>" .
"getTrackNumber: " . $ffmpegInstance->getTrackNumber()."<br>" .
"getYear: " . $ffmpegInstance->getYear()."<br>" .
"getFrameHeight: " . $ffmpegInstance->getFrameHeight()."<br>" .
"getFrameWidth: " . $ffmpegInstance->getFrameWidth()."<br>" .
"getPixelFormat: " . $ffmpegInstance->getPixelFormat()."<br>" .
"getBitRate: " . $ffmpegInstance->getBitRate()."<br>" .
"getVideoBitRate: " . $ffmpegInstance->getVideoBitRate()."<br>" .
"getAudioBitRate: " . $ffmpegInstance->getAudioBitRate()."<br>" .
"getAudioSampleRate: " . $ffmpegInstance->getAudioSampleRate()."<br>" .
"getVideoCodec: " . $ffmpegInstance->getVideoCodec()."<br>" .
"getAudioCodec: " . $ffmpegInstance->getAudioCodec()."<br>" .
"getAudioChannels: " . $ffmpegInstance->getAudioChannels()."<br>" .
"hasAudio: " . $ffmpegInstance->hasAudio();
?>

 7.执行后如果拿到视频的一些信息如下就表示环境配置成功了,那我们就可以开始开发我们的视频转换了。

执行结果:

getDuration: 811.13336181641
getFrameCount: 12167
getFrameRate: 15
getFilename: C:\wamp\www\top10.mp4
getComment:
getTitle:
getAuthor:
getCopyright:
getArtist:
getGenre:
getTrackNumber: 0
getYear: 0
getFrameHeight: 240
getFrameWidth: 320
getPixelFormat: yuv420p
getBitRate: 269769
getVideoBitRate:
getAudioBitRate:
getAudioSampleRate: 48000
getVideoCodec: mpeg4
getAudioCodec: mpeg4aac
getAudioChannels: 2
hasAudio: 1

 

转自:http://blog.csdn.net/koala_swnu/archive/2010/04/13/5482983.aspx

 

视频截图的话如下方法: //add by aboc

$ff_frame = $ffmpegInstance->getFrame(rand(1,$ffmpegInstance->getFrameCount())); //随机截取某一帧
$gd_image = $ff_frame->toGDImage();
imagejpeg($gd_image,'t.jpg');
imagedestroy($gd_image);

echo '<img src="t.jpg" />';