最近想安装PEAR(PHP Extension and Application Repository),但是在执行批处理文件go-pear.bat的时候出现了错误:
phar "C:\php\PEAR\go-pear.phar" does not have a signature
PHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\php\PEAR\go-pear.phar on line 1236
解决方案:开启一个命令行窗口,切换目录到php的目录下(我的目录为"C:\php"),然后输入php -d phar.require_hash=0 PEAR/go-pear.phar,这样就进入安装进程.
附:
---------------
pear命令帮助
---------------
在你的pear目录中可以找
到PEAR.PHP文件,这是管理pear的命令,在CMD中使用。它的部分命令功能如下:
安装:
自网路安装某一个
pear程式库:
pear install packagename
下载
packages
但不安装:
pear download packagename
......
在项目开发中发现对php的文档缺少管理,别人写了一个,功能不多
<?php
/**
* 类名: doc
*
描述: 文档生成类
* 其他: 可以对目录进行过滤,设置好源目录后,请用绝对路径指定生成目录,模式可调,模式
*
1为常规类型,即以 斜线**开头,以*斜线 结束
* 2为扩展类型,凡是 斜线*开头以*斜线 结束的部分都将成为文档的一部分
*/
class doc
{
var $docdirname;
var $docdir;
/**
*
函数名称: doc()
* 函数功能: 构造
* 输入参数: none
* 函数返回值: 返回值说明
*
其它说明: 2004-10-13
*/
function doc()
{
$this->docdirname
= "doc/";
}
/**
* 函数名称:
createDoc($root,$newdir,$mode="1",$filter=null)
* 函数功能: 创建文档
*
输入参数: $root -------------- 源目录
$newdir ----------- 目标目录
$mode
------------- 模式,1为普通,2为扩展
$filter ------------ 过滤目录
* 函数返回值:
返回值说明
* 其它说明: 2004-10-13
*/
function
createDoc($root,$newdir,$mode="1",$filter=null)
{
$getarr =
$this->loopDir($root,$filter); ......
1.用户定义排序:usort($array, functionName);其中functionName为用户定义的函数名,用户定义的函数指定排序规则,比较数组中两个元素的大小,大于返回正数,小于返回负数,等于返回0。2.反向用户排序:用户定义函数时,比较数组中两个元素的大小,大于返回负数,小于返回正数,等于返回0。$fruits = array(array('APP', 'Apple', 3.2), array('ORG', 'Orange', 2.6),
array('JIM','linina','3.4'));
echo 'Init:
';
foreach($fruits as $key)
{
echo $key['2'];
}
//按名称排序
function compareByName($x, $y) {
if ($x[1] == $y[1]) {
return 0;
}
else if ($x[1] > $y[1]) {
return 1;
} else {
return -1;
}
}
usort($fruits, 'compareBYName');
echo '
Compare By Name:
';
for ($i = 0; $i < 3; $i++) {
for ($j = 0; $j < 3; $j++) {
echo '|'.$fruits[$i][$j];
}
echo '
';
}
//按价格排序
function compareByPrice($x, $y) {
if ($x[2] == $y[2]) {
return 0;
}
else if ($x[2] > $y[2]) {
return 1;
}
else {
return -1;
}
}
usort($fruits, 'compareBYPrice');
echo '
Compare By Price:
';
for ($i = 0; $i < 3; $i++) {
for ($j = 0; $j < 3; $j++ ......
<?php
$mydbhost ="localhost"; //配置主机
$mydbuser ="root"; //数据库用户
$mydbpw ="8312836"; //数据库密码
$mydbname ="jingyun"; //数据库名
//$mydbcharset ="GBK";
$conn=mysql_connect($mydbhost,$mydbuser,$mydbpw) or die ("服务器连接错误".mysql_error());
mysql_select_db($mydbname,$conn);
mysql_query("SET NAMES 'utf8'");
date_default_timezone_set ('PRC');
$addtime=date("y-m-d H:i:s");
//定义常量
define('ALL_PS',"nkfwe24tot");//二次加密,密码字符
//echo md5("admin".ALL_PS);
//信息提示函数
function showmsg($text,$urlstr="")
{
if($urlstr){
echo '<Script>alert("'.$text.'");window.location.href="'.$urlstr.'";</Script>';
exit;
}
else {
echo "<Script>alert('".$text."');history.go(-1);</Script>";
exit;
}
}
?> ......
<?
@session_start();
$counter = intval(file_get_contents("counter.dat"));
if(!$_SESSION['jingyun'])
{
$_SESSION['jingyun'] = true;
$counter++;
$fp = fopen("counter.dat","w");
fwrite($fp, $counter);
fclose($fp);
}
?>
总访问 <span style="font-size:14px; color:#FF6600" mce_style="font-size:14px; color:#FF6600"><?php echo "$counter";?></span> 次 ......
头部调用
<?
require('conn.php');
$sql1="select id from news";
$query1=mysql_query($sql1,$conn);
$sun_num=mysql_num_rows($query1);
$gs=20;
$page_num=ceil($sun_num/$gs);
include("../subpage.php");
//传过来的页数参数
$PB_page=$_GET['PB_page'];
if ($PB_page==1 or empty($PB_page)){
$a=0;
}else{
$a=(($PB_page-1)*$gs);
}
?>
HTML部分代码
<div style="margin-top:10px;" mce_style="margin-top:10px;">
<table width="99%" border="0" cellspacing="0" cellpadding="0">
<form id="form1" name="form1" method="get" onsubmit="return checkkey()"> <tr>
<td width="9%" height="25" align="center">
<span style="color:#067098; font-weight:bold" mce_style="color:#067098; font-weight:bold">文章搜索:</span> </td>
<td width="25%" align="left"><input name="key" type="text" class="txt" id="key" size="40"/></td>
<td width="66%" align="left"><input type="submit" name="Submit" ......