昨天本来想用pear加载一个HTML_quickForm2的表格模块的但是总是会出现许多的错误 在windows7下安装运行go-pear.bat的时候会提示到:“……~\Zend\ZendServer\bin\PEAR\go-pear.phar does not have a signature”按任意键继续这个提示!最后知道是要修改…..\Zend\ZendServer\bin\go-pear.bat的内容,右键编辑,把内容替换为以下:
@ECHO OFF
set PHP_BIN=php.exe
rem %PHP_BIN% -d output_buffering=0 PEAR\go-pear.phar
%PHP_BIN% -d phar.require_hash=0 PEAR\go-pear.phar
pause
保存双击击就可以安装pear了!按照提示设置。一直点击enter遇到yes/no输出y安装!
最后打开windows目录下的php.ini文件,然后查找到如下的地方:
pear安装好后(用运行-》CMD -》pear list可以查看是否安装好)运行pear install HTML_QuickForm2 安装模块又出现了很多错误(这个安装之前还要首先安装HTML_Common2):如下
Warning: strtotime(): It is not safe to rely on the system’s timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone
_set() function. In case you used any of those methods and you are still getting
this warning, you most likely misspelled the timezone identifier. We selected ‘
UTC’ for ’8.0/no DST’ instead in PEAR\Validate.php on line 489
downloading HTML_Common-1.2.5.tgz …
Starting to download HTML_Common-1.2.5.tgz (4,585 bytes)
…done: 4,585 bytes
Warning: strtotime(): It is not safe to rely on the system’s timezone settings.
You are *required* to use the date.timezone setting or the date_default_timezone
_set() function. In case you used any of those methods and you are still getting
this warning, you most likely misspelled the timezone identifier. We selected ‘
UTC’ for ’8.0/no DST’ instead in PEAR\Validate.php on line 489
Warning: require_once(Structures/Graph.php): failed to open stream: No such file
or directory in PEAR\Downloader.php on line 1230
Warning: require_once(): It is not safe to rely on the system’s timezone setting
s. You are *required* to use the date.timezone setting or the date_default_timez
one_set() function. In case you used any of those methods and you are still gett
ing this warning, you most likely misspelled the timezone identifier. We selecte
d ‘UTC’ for ’8.0/no DST’ instead in PEAR\Downloader.php on line 1230
解决办法:
对于You are *required* to use the date.timezone setting or the date_default_timezone
_set() function.只要修改php.ini就可以了 查找date.timezone 去掉前面的分号修改成为:date.timezone =PRC
没有了怎么办,那就直接添加到php.in就可以了,然后重启apache。
Warning: require_once(Structures/Graph.php): failed to open stream: No such file or directory in PEAR\Downloader.php on line 1230这个的解决办法:
1.下载并解压缩 Structures_Graph-1.0.3,从 pear.php.net 网站。
2.手动安装文件包Structures_Graph-1.0.3,选择里边的Structures文件夹拷贝到指定的PEAR目录,如果不知道的话运行-》CMD-》pear config-show找到 ”PEAR directory php_dir”,拷贝到这个对应的目录下就可以了(我的是ProgramFiles\Zend\ZendServer\bin\PEAR)下,重启apache。然后运行 pear install Structures_Graph安装,虽然说没有安装,如下:
C:\Users\Administrator>pear install Structures_Graph
downloading Structures_Graph-1.0.4.tgz …
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
………done: 30,318 bytes
install ok: channel://pear.php.net/Structures_Graph-1.0.4
没有出现错误啦!而且升级到1.0.4了呵呵!仿照这个方法如果升级错误,就手动安装吧!也可以动手升级可以升级的pear,
运行pear upgrade PRAR升级pear。到这里也就算安装好了!让我们来看一个实例吧!
用HTML_QuickForm2加载一个表格!
- ><?php
- require_once "HTML/QuickForm2.php";
- require_once 'HTML/QuickForm2/Renderer.php';
- $format = array(
- '' => 'Newsletter Format:',
- 'text' => 'Text',
- 'html' => 'HTML'
- );
- $form = new HTML_QuickForm2('newsletter');
- $name = $form->addText('name')->setLabel('Your Name:');
- $email = $form->addText('email')->setLabel('Your E-mail Address:');
- $newsletter = $form->addSelect('format', null, array('options' => $format));
- $newsletter->setLabel('Preferred Newsletter Format:');
- $form->addElement('submit', null, 'Submit!');
- $renderer = HTML_QuickForm2_Renderer::factory('default');
- echo $form->render($renderer);
- ?>