4个著名的PHP应用系统
2008-02-21 星期四 10:21 :: PHPJoomla 开源内容管理系统,CMS
OsCommerce 网店系统,基本上没怎么在更新
Zen Cart 从上面那个延伸出来的网店系统,但更新很活跃,代码重写的
Cubecart 新生的网店系统
Joomla 开源内容管理系统,CMS
OsCommerce 网店系统,基本上没怎么在更新
Zen Cart 从上面那个延伸出来的网店系统,但更新很活跃,代码重写的
Cubecart 新生的网店系统
/* 遍历文件夹
* 用法
* foreach (getDir(dirname(__FILE__)) as $dir) {
* echo $dir.”
“;
* }
*/
function getDir($dir) {
$fileArr = array();
$dp = opendir($dir);
while(($file = readdir($dp)) !== false) {
if($file !=”.” AND $file !=”..” AND $file !=”") {
if(is_dir($dir.”/”.$file)) {
$fileArr = array_merge($fileArr, getDir($dir.”/”.$file));
$fileArr[] = $dir.”/”.$file;
}
}
}
closedir($dp);
return $fileArr;
}
// 获取当前目录名称
$dir=getcwd();
$dir=basename($dir);
echo $dir;
// 判断目前的类别是否是选择的类别
function iif ($expression,$returntrue,$returnfalse) {
if ($expression==0) {
return $returnfalse;
} else {
return $returntrue;
}
}
// 取数组中的内容
function getArrayContent($content, $key) {
$oneValue = split($key, $content);
for ($i=0; $i
}
}
// 拦截非提交的ID(从地址栏中直接输入的),
function blockID() {
$serverName=$_SERVER["SERVER_NAME"];
$subFrom=$_SERVER["HTTP_REFERER"];
$subLen=strlen($serverName);
$checkFrom=substr($subFrom,7,$subLen);
if ($checkFrom != $serverName) {
echo '非法ID';
exit;
}
}
// 验证日期格式是否正确
function is_date_format($string)
{
if ( preg_match("/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/",$string) )
{
$first_sep = strpos($string,"-");
$year = substr($string,0,$first_sep);
$part_month_day = substr($string,$first_sep+1);
$last_sep = strpos($part_month_day,"-");
$month = substr( $part_month_day,0,$last_sep );
$day = substr($part_month_day,$last_sep+1);
if ( checkdate($month, $day, $year) ) {
return 1;
}else{
return 0;
}
}else {
return 0;
}
}
最灵活的类似Digg的Web2.0 CMS系统….以前本站曾推荐过
官方:http://www.pligg.com/
国内:http://www.alicrm.cn/
对比phpdug,感觉phpdug还有很多问题,特别是安装方面
在CMD中使用,PackageName为你要使用的包
| 参数 | 功能 | 使用格式 |
| install | 安装新的包 | pear install PackageName |
| uninstall | 卸载已安装的包 | pear uninstall PackageName |
| download | 包下载但不安装 | pear download PackageName |
| download-all | 下载所有包但不安装 | pear download-all PackageName |
| list | 列出已安装的包 | pear list |
| remote-list | 列出pear网站所有可下载的包 | pear remote-list |
| info | 查看包的说明 | pear info PackageName |
| upgrade | 更新(升级)包 | pear upgrade PackageName |
| upgrade-all | 更新(升级)所有已取得的包 | pear upgrade-all |
echo gmdate("D, d M Y H:i:s",mktime(date("H,i,s,m,d,Y")));
输出效果:Mon, 27 Nov 2006 10:06:04
在RSS的description标签中,一般我们都要把html代码去掉,只保留文字内容,但经常的又想把br这类代码保留,因为分段能给浏览者更加舒服的查看内容,高手当然可以用正则,不过我等懒人+菜鸟可不想在正则上花太多的时间,在PHP手册里找了半天,终于发现了strip_tags函数:
去掉 HTML 及 PHP 的标记,可以指定允许保留的html代码。
真爽,PHP真是面面俱到啊,立马找了段用HTML编码器(FCKeditor)生成的正文内容,测试,PASS!

function DateDiff($d1,$d2=""){ //日期比较函数
if(is_string($d1))$d1=strtotime($d1);
if(is_string($d2))$d2=strtotime($d2);
return ($d2-$d1)/86400;
}
if ($submit) {
echo DateDiff($d1,$d2);
}else {
echo '
‘;
}
?>
“使用链接表的额外特性尚未激活”修正办法!本文来自 ChinaUnix。
在使用了新的 phpmyadmin (2.6.0-beta*或者更高版本) 来管理mysql后,你每打开一个库的时候,会看到这么一句:
错误
使用链接表的额外特性尚未激活。要查出原因,请单击此处。
单击了所谓的此处后,会跳到一个页面显示:
PMA Database … 不好[ 文档 ]
一般关系特性 已禁用
Starting with version 2.3.0 phpMyAdmin offers a lot of features to work with master / foreign – tables. To use those as well as the bookmark feature you need special tables with a predefined structure, which we explain below.
See the Quick Install section in this document for a quick way of creating those tables. Also, if you are using a Windows server, read FAQ 1.23.
If you are the only user of this phpMyAdmin installation, you can use your current database to store those special tables; in this case, just put your current database name in $cfg['Servers'][$i]['pmadb'].
If you are setting up a multi-user phpMyAdmin installation, you will need to create a new database and setup special privileges, so, as superuser:
create a new database for phpMyAdmin:
CREATE DATABASE phpmyadmin;
Note that “controluser” must have SELECT, INSERT, UPDATE and DELETE privileges on this database. Here is a query to set up those privileges (using “phpmyadmin” as the database name, and “pma” as the controluser):
GRANT SELECT,INSERT,UPDATE,DELETE ON phpmyadmin.* to ‘pma’@'localhost’;
do not give any other user rights on this database.
enter the database name in $cfg['Servers'][$i]['pmadb']
先建立一个名为phpmyadmin的数据库
然后把目录下scripts/create_tables.sql导入到这个库 mysqldir/bin/mysql -u root -p /phpadmin_dir/scripts/create_tables.sql
打开 config.inc.php 配置文件.
$cfg['Servers'][$i]['pmadb'] = ”; // ‘phpmyadmin’ – see scripts/create_tables.sql
$cfg['Servers'][$i]['bookmarktable'] = ”; // ‘pma_bookmark’
$cfg['Servers'][$i]['relation'] = ”; // ‘pma_relation’
$cfg['Servers'][$i]['table_info'] = ”; // ‘pma_table_info’
$cfg['Servers'][$i]['table_coords'] = ”; // ‘pma_table_coords’
$cfg['Servers'][$i]['pdf_pages'] = ”; // ‘pma_pdf_pages’
$cfg['Servers'][$i]['column_info'] = ”; // ‘pma_column_info’
$cfg['Servers'][$i]['history'] = ”; // ‘pma_history’
$cfg['Servers'][$i]['pmadb'] = ‘phpmyadmin’; // ‘phpmyadmin’ – see scripts/create_tables.sql
$cfg['Servers'][$i]['bookmarktable'] = ‘pma_bookmark’; // ‘pma_bookmark’
$cfg['Servers'][$i]['relation'] = ‘pma_relation’; // ‘pma_relation’
$cfg['Servers'][$i]['table_info'] = ‘pma_table_info’; // ‘pma_table_info’
$cfg['Servers'][$i]['table_coords'] = ‘pma_table_coords’; // ‘pma_table_coords’
$cfg['Servers'][$i]['pdf_pages'] = ‘pma_pdf_pages’; // ‘pma_pdf_pages’
$cfg['Servers'][$i]['column_info'] = ‘pma_column_info’; // ‘pma_column_info’
$cfg['Servers'][$i]['history'] = ‘pma_history’; // ‘pma_history’
这样保存后刷新页面就好了。
---------------------
我看了下,主要是将 scripts/create_tables.sql 这个导入数据库,注意这个 SQL 文件存在着 DROP DATABASE 语句,所以可以不用手动建立数据库,直接执行这个 SQL 文件就行了,其实也可以导入到其他数据库中,只是上面配置中的 $cfg['Servers'][$i]['pmadb'] 改成所使用的数据库名称就行了,其他按照默认配置填写一下,如果你没有修改表名就按照默认的。添加这个以后 PHPMyAdmin 会多出一些功能,具体的大家测试了就知道了,我没详细看,再次感谢本文作者,解决了这个一直困扰的问题。
--深空