分类:技术
PHP 调试和异步调试工具类
function gddebug() {
	$arrays = func_get_args ();
	echo "n<pre>";
	foreach ( $arrays as $value ) {
		if (is_array ( $value ) || is_object ( $value )) {
			ksort ( $value );
			echo htmlspecialchars ( print_r ( $value, true ) ) . "rn";
		} elseif (is_string ( $value )) {
			echo "string(" . strlen ( $value ) . ") "" . htmlspecialchars ( $value ) . ""rn";
		} else {
			var_dump ( $value );
		}
	}
	echo "</pre>";
}
异步调试工具类
function gdsyndebug() {
	$arrays = func_get_args ();
	$filename = dirname ( __FILE__ ) . "/gdsyndebug.txt";
	file_put_contents ( $filename, "===================" . date ( "Y-m-d H:i:s" ) . "====n", FILE_APPEND );
	file_put_contents ( $filename, 'url http://' . $_SERVER ['HTTP_HOST'] . $_SERVER ['PHP_SELF'] . "n", FILE_APPEND );
	foreach ( $arrays as $value ) {
		if (is_array ( $value ) || is_object ( $value )) {
			ksort ( $value );
			file_put_contents ( $filename, print_r ( $value, true ) . "n", FILE_APPEND );
		} elseif (is_string ( $value )) {
			file_put_contents ( $filename, "string(" . strlen ( $value ) . ") "" . $value  . ""n", FILE_APPEND );
		} else {
			file_put_contents ( $filename, var_export ( $value, true ) . "n", FILE_APPEND );
		}
	}
}
转发请注明出处http://blog.martoo.cn
如有漏缺,请联系我 QQ 243008827
PclZip 操作及文件授权+设置用户,用户组
经常出现这种窘境,在公司上传东西的时候,需要传个easyui目录..再加个yiiframework哩。而且服务器没有linux的操作权限,zip的扩展也是没有的时候…如果以上都不是问题就跳出去吧呵呵。
http://www.phpconcept.net/pclzip/user-guide/18
这时肯定要将代码压缩下,传压缩包再通过代码去解压。
	
	//普通的打包操作
	$path = dirname ( __FILE__ ) . '/fw.zip';//目标zip
	require_once (dirname ( __FILE__ ) . '/pclzip.lib.php');
	$archive = new PclZip ( $path );
	$archive->create ( "fw" );//当前需要打包的目录
	if ($archive->extract () == 0) {
		die ( "Error : " . $archive->errorInfo ( true ) );
	}
	//打包指定目录,然后移除目录前缀
	$path = dirname ( __FILE__ ) . '/fw.zip';
	require_once (dirname ( __FILE__ ) . '/pclzip.lib.php');
	$archive = new PclZip ( $path );
	$archive->add ( "C:/ooxx/ooxx/htdocs/test/zip/fw", PCLZIP_OPT_REMOVE_PATH, "/ooxx/ooxx/htdocs/test/zip/" ); // 压缩);
	if ($archive->extract () == 0) {
		die ( "Error : " . $archive->errorInfo ( true ) );
	}
	//普通的解包
	$path = dirname ( __FILE__ ) . '/fw.zip';
	require_once (dirname ( __FILE__ ) . '/pclzip.lib.php');
	$archive = new PclZip ( $path );
	if ($archive->extract () == 0) {
		die ( "Error : " . $archive->errorInfo ( true ) );
	}
看一送一,因为解压后的特殊原因,权限是只有应用的,如果ftp操作肯定是不行滴
//迭代授权,这样就绝配了。
function chmod_R($path, $filemode) {
	if (! is_dir ( $path ))
		return chmod ( $path, $filemode );
	$dh = opendir ( $path );
	while ( $file = readdir ( $dh ) ) {
		if ($file != '.' && $file != '..') {
			$fullpath = $path . '/' . $file;
			if (! is_dir ( $fullpath )) {
				if (! chmod ( $fullpath, $filemode ))
					return FALSE;
			} else {
				if (! chmod_R ( $fullpath, $filemode ))
					return FALSE;
			}
			// echo $fullpath."<br>";
		}
	}
	closedir ( $dh );
	if (chmod ( $path, $filemode ))
		return TRUE;
	else
		return FALSE;
}
//用户和用户组的设置
function recurse_chown_chgrp($mypath, $uid, $gid) {
	$d = opendir ( $mypath );
	while ( ($file = readdir ( $d )) !== false ) {
		if ($file != "." && $file != "..") {
			$typepath = $mypath . "/" . $file;
			// print $typepath. " : " . filetype ($typepath). "<BR>" ;
			if (filetype ( $typepath ) == 'dir') {
				recurse_chown_chgrp ( $typepath, $uid, $gid );
			}
			chown ( $typepath, $uid );
			chgrp ( $typepath, $gid );
		}
	}
}
转发请注明出处http://blog.martoo.cn
如有漏缺,请联系我 QQ 243008827
百度编辑器小记
不用多说了,直接上链接。
强悍的截图,对于有需要,但又没资源做这类插件的…
配置相关:
相对于常见mvc.脚本的引用通常不是同级目录的,编辑的配置需要留意的地方有
1.ueditoreditor_api.js
baseURL//脚本的引用
2.ueditor/editor_config.js
window.UEDITOR_HOME_URL //插件目录配置
snapscreenHost: location.href.replace(/^http://([^/]+)/.*/,'$1') //截屏的服务器配置。
langPath:URL +"lang/" //语言包,默认被注释
themePath:URL +"themes/" //样式包,默认被注释
Mysql中获取刚插入的自增长id的三种方法归纳
KindEditor 小记
插件编写:
http://www.kindsoft.net/ke4/examples/custom-plugin.html
查看顺序:配置(items)>脚本(对应的目录,单击是直接调用目录下的脚本)>样式(主要显示图标)
this 变量的指针指向 当前的editor
弹出dialog:
http://www.kindsoft.net/docs/dialog.html
两种,这种直接显示,不用通过对像
缺点,不支持指定对象显示。可以尝试 $(“obj”).html()插入 Y(^_^)Y
简单在线编辑器
http://www.cnblogs.com/keepfool/archive/2011/12/21/2295335.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>KF富文本编辑器</title>
<script type="text/javascript" src="http://common.cnblogs.com/script/jquery.js">
</script>
<script type="text/javascript">
$(function(){
    $d = $("#editor")[0].contentWindow.document; // IE、FF都兼容
    $d.designMode="on";
    $d.contentEditable= true;
    $d.open();
    $d.close();
    $("body", $d).append("<div>A</div><div>B</div><div>C</div>");
    $('#insert_img').click(function(){
        // 在iframe中插入一张图片                                   
        var img = '<img src="' + $('#path').val() +'" />';
        $("body", $d).append(img);
    });
    $('#preview').click(function(){
        // 获取iframe的body内容,用于显示或者插入到数据库
        alert($('#editor').contents().find('body').html());
        $('#preview_area').html($('#editor').contents().find('body').html());
    });
});
</script>
</head>
<body>
<p><iframe id="editor" width="600px" height="200px" style="border:solid 1px;"></iframe></p>
<input type="text" id="path" value="http://www.google.com/images/errors/robot.png"/>
<input type="button" id="insert_img" value="插入图片" />
<input type="button" id="preview" value="预览" />
<p style="border: 1px dashed #ccc;" id="preview_area"></p>
</body>
</html>
设计、美工相关 收藏
配色:
http://www.peise.net/
设计欣赏:
http://www.itdream.com.cn/design-graphic/13587_2.html
javascript 效果:
http://blog.163.com/guoqiang_s/blog/static/1678978712010112761646744/
PhpMyAdmin 实用技巧
禁止:root
confgi.inc.php
$cfg['Servers'][$i]['AllowRoot'] = false;
js 插件集
评分:
星星评分
滚动插件
http://www.gmarwaha.com/jquery/jcarousellite/?#doc
visible:6,
自定义滚动条
http://www.net-kit.com/jquery-custom-scrollbar-plugins/?1365058929
分享
www.bshare.cn
分享(猜你喜欢,推荐,分享)
http://www.jiathis.com/