现在的位置: 首页 > PHP
0℃
2013年08月30日 Web设计 ⁄ 被围观 3,400+
在优化网站的过程中,其中一个规则就是尽量减少HTTP的请求数量,比如图片的合并,JS,CSS代码的合并等,本文介绍了一款PHP的自动合并脚本,可以在网站中使用,只要将原来需要引用JS和CSS的地方,换成该脚本的函数调用,那么脚本就会自动将过个请求合并成一个请求,重而提高网站的打开速度。 Combining Assets One of the basic tenets of making a web-page load quickly is reducing the number of HTTP requests that your page makes. One very common way of doing this, is assuring that all of your CSS fi...
阅读全文
0℃
2013年08月15日 Web设计 ⁄ 被围观 3,146+
在编程的过程中,尤其是文本的处理,我们很多时候都需要正则表达式,比如,验证用户输入的Email是否格式正确,电话号码是否符合规范,或者其他的自定义规则。对新手来说,熟记正则表达式的规则比较困难,那么有没有一种更符合自然语义的正则表达式呢,本文会给你答案。 Most newbie (and some seasoned) programmers have difficultly constructing Regular Expressions. Many a times one needs to create a Regexp quickly to test a a particular piece of code. However, not being comfortable withe Regexp...
阅读全文
0℃
2013年08月15日 Web设计 ⁄ 被围观 3,271+
php中使用session的场合主要是用户登录信息的记录和页面之间数据的传递,session的有效期为浏览器的生存期,直到用户关闭浏览器,服务器中的session数据才清除。本文介绍了怎么样利用session来存储变量。 In this article I’m going to show you some simple things to work with sessions in php, these are mostly used to store information about your users, like usernames, choices selected by users and similar, these however are stored on the server and deleted once the user closes the browser....
阅读全文
0℃
2013年08月08日 移动开发 ⁄ 被围观 3,775+
开发过移动APP的同学都知道云推送,比如Google的后台服务,联系人同步,邮件同步,APK的自动升级等都是这个机制,其实利用云推送机制还可以实现消息的发送,本文介绍了一种基于PHP后台的推送机制,实现原理还是通过Google的云端服务(Google Cloud Messaging for Android service),android客户端采用的是phoneGap的PushPlugin。 Last days I’ve been working within a Phonegap project for Android devices using Push Notifications. The idea is simple. We need to use the Push Notification Plugin for Andr...
阅读全文
0℃
2013年05月19日 程序设计 ⁄ 被围观 4,719+
昨天,测试了PHP方式登录百度空间,可以参见博文《PHP 登录百度空间》,今天通过抓包工具的分析,分析了博文的发布过程,实现了博文的自动发布。 参照代码如下: private function postArticle($baiduzoneurl, $title, $content, $category, $blogpower) { $post_data = array(); $post_data["title"] = $title; $post_data["tags[]"] = $category; $post_data["content"] = $content; $post_data["private"] = $blogpower == 0? "" : "1"; $post_data["imgnum"] = "0"; $post_data["bdstoken"] = $this-&...
阅读全文
1℃
2013年05月18日 程序设计 ⁄ 被围观 3,752+
前几天,先测试了利用Python脚本登录百度空间,问题已解决,可以参照我的博文《python 脚本登录百度空间》,今天完善了php方式的登录过程,原理同python脚本的登录。 代码如下: 登录代码 private function loginBaiduZone($user,$password) { //get Cookie $ret = $this->doHttpPost("https://passport.baidu.com/v2/api/?getapi&class=login&tpl=mn&tangram=false", "", ""); //get token $ret = $this->doHttpPost("https://passport.baidu.com/v2/api/?getapi&class=login&tp...
阅读全文
3℃
2012年06月01日 程序设计 ⁄ 被围观 5,954+
问题 客户端采用Java语言编写,服务器端采用PHP语言编写,数据库采用Mysql存储,客户端和服务器之间的交互采用Json,在传递英文数据的时候没有问题,当传递中文数据数据的时候,就会出现中文乱码问题,mysql里面的中文全部变成问号了。 解决方案 Mysql数据库,数据表,数据字段采用统一编码UTF-8, 如 utf8_general_ci 客户端Java字符串转成json格式的时候先进行urlencode处理 JSONObject jo = new JSONObject(); //jo.accumulate("note", note); jo.accumulate("note", URLEncoder.encode(note)); 服务器端PHP...
阅读全文
0℃
2012年04月08日 程序设计 ⁄ 被围观 5,051+
这几天做项目,其中一个需求是用户上传视频文件到服务器,然后服务器自动截取该视频的一帧作为该视频对应的缩略图,服务器端语言采用php编写,找了半天资料,发现ffmpeg-php可以满足该需求,所以下面简单介绍一下该扩展库的配置和使用方法。 测试服务器环境 WampServer Version 2.1,php5.3.5,ffmpeg-php 配置和使用步骤如下: 1. 下载 ffmpeg-php, ffmpeg-php-5.3-win32-all.zip 2. 将 php_ffmpeg.dll 放到 PHP 扩展目录,(例如 E:\Program Files\wamp\bin\php\php5.3.5\ext) 3. 将其他的dll文件放到系统目录...
阅读全文
×
腾讯微博