随笔分类 - php
yii,ZendFramework,acmp
摘要:php file_get_contents计时读取一个文件/页面 防止读取不到内容$url = 'http://www.baidu.com/index.php';$opts = array( 'http' => array( 'method' => 'GET', 'header' => 'Accept-language: en\r\n'.'Cookie: foo=bar\r\n', 'timeout'=> 20 ) ); $context =
阅读全文
摘要:jquery ajax中 前台后台文件中编辑都是uft-8,返回数据还是乱码解决如下:在后台处理文件里面需要再加编辑header("Content-Type:text/html;charset=utf-8");
阅读全文
摘要:Warning: imagettfbbox() [function.imagettfbbox]: Invalid font filename...[可能没有默认的字体]例://putenv('GDFONTPATH=C:\WINDOWS\Fonts');$font = "Arial";$size = 12;$im = ImageCreateFromPNG("top_logo.png");$tsize= imagettfbbox($size, 0, $font, $_GET['message']);改成://putenv(
阅读全文
摘要:工作需要用到yii框架,但发现yii框架自带的提示都是英文的。上网找资料才发现其实可以自己陪置 。将项目protected/config/main.php里的app配置加上language=>'zh_cn',系统默认的提示就是中文的了 'language'=>'zh_cn', 不过YII框架本身是,UTF-8的,如果你的整个网站延用UTF-8,我觉得这句可加可不加。这个需要修改你的模型类的验证规则,如下:public function rules(){return array(array('username, password
阅读全文
摘要:1. 在main.php配置文件中加入 'language'=>'zh_cn',注: 在URL中追加参数lang=zh_cn即可实现中文2. 在Controller方法中添加 1 public function init() 2 { 3 if(isset($_REQUEST['lang'])&&$_REQUEST['lang']!="") //通过lang参数识别语言 4 { 5 Yii::app()->language=$_REQUEST['lang']; 6 ..
阅读全文
摘要:新手在执照yii教程来的时候,config/main.php文件是全新写的,post提交的时候,会出错include(LoginForm.php) [function.include]: failed to open stream: No such file or directory需要在config/main.php文件里设置,增加:'import'=>array( 'application.models.*', 'application.components.*', ),
阅读全文
摘要:public function rules() { return array( array('username, password', 'required'), array('rememberMe', 'boolean'), array('password', 'authenticate'), ); }在上面的例子中,required名字是CRequiredValidator的别名,它用于确保所验证的特性值不为空。 下面是预定义的验证器别名的完整列表:boolean:CBooleanVa...
阅读全文
摘要:最近自学Zendframework中,写Controller的时候总要require model下的类文件,然后才能实例化,感觉非常不爽Google了许久,找到个明白人写的方法不错,主要就是修改application下的Bootstrap.php文件全部代码如下: 1 '','basePath'=>APPLICATION_PATH));14 15 /* 实现自动加载Models下的类 */16 17 $autoloader = Zend_Loader_Autoloader::getInstance();18 19 $autoloader->set..
阅读全文
摘要:php通过去访问外部网站时,出现以下提示:PHP Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolutin 其原因是dns未设置,不是php本身或程序的原因,可以通过添加dns解决设置dns如下: $ vi resolv.conf nameserver 202.96.128.68 nameserver 219.136.241.206
阅读全文
浙公网安备 33010602011771号