Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
@rtxbc
rtxbc / gist:1881744
Created February 22, 2012 05:41
观察者模式[php]
<?php
/**
* 观察者模式
* @author: Mac
* @date: 2012/02/22
*/
class Paper{ /* 主题 */
private $_observers = array();
@rtxbc
rtxbc / gist:1824805
Created February 14, 2012 08:28
javascript 和 php 传字符串编码处理
javascript:
var ajaxRUrl = 'http://'+domain+'/star/~ajax/relateMsg?q='+encodeURI('{$personname}');
PHP:
$personname = urldecode($_GET['q']);
@rtxbc
rtxbc / gist:1787992
Created February 10, 2012 09:23
删除数组元素 【php】
<?php
$t = array(1, 3, 4, 5);
var_dump($t);
foreach($t as $k => &$v){
if(1 === $k){
unset($t[$k]);
//unset($v); //这种方法不起作用
}
}
var_dump($t);