<?php
class Mysql{
protected $conn;
public function __construct($dbhost, $dbuser, $dbpass, $dbname){
$this->conn = mysql_connect($dbhost, $dbuser, $dbpass, 1);
if(!$this->conn){
die('Could not connect: ' . mysql_error());
}
mysql_select_db($dbname, $this->conn);
......................
阅读全部
|
静夜思
贴于 2014年6月25日 09:20
hide
bbsi
<?php
function git_commit_change(){
exec("git status", $l);
$s = implode('', $l);
if(strpos($s, "nothing to commit") === false){
if(strpos($s, 'delete')!==false){
foreach($l as $line){
if(strpos($line, 'delete')!==false){
$deleted_file = trim(str_replace("deleted:",'',$line));
system("git rm ".$deleted_file);
}
......................
阅读全部
|
静夜思
贴于 2014年5月28日 16:14
hide
bbsi
<?php
function path_join(){
$args = func_get_args();
$paths = array();
foreach ($args as $arg) {
$paths = array_merge($paths, (array)$arg);
}
$paths = array_map(function($p, $k){
if($k == 0){
return rtrim($p, "/");
}else{
......................
阅读全部
|
静夜思
贴于 2014年5月8日 14:32
hide
bbsi
<?php
class ObjectArray{
private $obj;
public function __construct($array)
{
$this->obj = $array;
return $this;
}
public function add($arr)
......................
阅读全部
|
静夜思
贴于 2013年1月18日 21:44
hide
bbsi
<?php
class ObjectArray{
private $obj;
public function __construct($array)
{
$this->obj = $array;
return $this;
}
public function count($item = null){
......................
阅读全部
|
静夜思
贴于 2013年1月15日 23:46
hide
bbsi
<?php
class ObjectArray{
private $obj;
public function __construct($array)
{
$this->obj = $array;
return $this;
}
public function count($item = null){
......................
阅读全部
|
静夜思
贴于 2013年1月15日 23:24
hide
bbsi
<?php
class Arr{
private $obj;
public function __construct($array)
{
$this->obj = $array;
return $this;
}
public function each($func)
......................
阅读全部
|
静夜思
贴于 2013年1月15日 16:47
hide
bbsi
<?php
$ad[1]="http://www.19e8.com/"; //页面1
$ad[2]="http://www.google.com.hk/search?q=%E7%94%B5%E8%84%91%E7%BB%B4%E4%BF%AE%E5%86%9B%E5%9B%A2%E4%B8%BB%E6%9D%BF%E7%BB%B4%E4%BF%AE%E5%85%A8%E9%9B%86&hl=zh-CN&newwindow=1&safe=strict&tbo=d&ei=3u_HUK-vGoijiAexloDIBA&start=130&sa=N"; //页面2
$ad[3]="http://www.google.com.hk/search?hl=zh-CN&newwindow=1&safe=strict&tbo=d&q=%203d%20max%E7%B2%92%E5%AD%90%E6%B1%87%E8%81%9A"; //页面3
$ad[4]="http://www.google.com.hk/search?client=aff-360daohang&hl=zh-CN&ie=utf-8&newwindow=1&q=%E7%90%86%E5%8F%91%E5%85%A5%E9%97%A8%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B"; //页面4
$ad[5]="http://www.google.com.hk/search?q=%E5%AE%8C%E7%BE%8E%E5%8F%B6%E5%AD%90%E7%BC%96%E7%BB%87%E8%A7%86%E9%A2%91%E7%AC%AC%E4%BA%94%E5%8D%81%E5%85%AB%E9%9B%86&ie=UTF-8&oe=UTF-8&hl=zh-hans&client=safari&hl=zh-CN&sourceid=cndr"; //页面5
$ad[6]="http://www.google.com.hk/search?hl=zh-CN&newwindow=1&safe=strict&tbo=d&q=3dmax%E7%89%87%E5%A4%B4%E5%8A%A8%E7%94%BB%E6%95%99%E5%AD%A6&btnG=Google+%E6%90%9C%E7%B4%A2"; //页面6
$out=rand(1, 6);//随机取得这5个页面的一个,有几个就写几, 此例有5个页面,就写 5
header("location:$ad[$out]"); //在需要的地方调用本句,页面转向
?>
阅读全部
|
liliang456
贴于 2013年1月8日 14:51
hide
bbsi