
php
iteye_13003
这个作者很懒,什么都没留下…
展开
-
php常用前端语法整理收集
以下为前端常用php语法: // 定义变量<!--{eval $colSize = sizeof($navlist);}--><!--{eval $vip_level_points = array(0, 10000, 20000, 35000, 50000, 75000);}-->//数组<!--{eval $cur_level = $_G[v...原创 2016-02-23 14:42:47 · 327 阅读 · 0 评论 -
新浪云平台Storage操作PHP版
获取Domain(qiaole)下own目录下的文件列表:$storage = new SaeStorage();$domain = "qiaole";$num = 0;while ( $ret = $storage->getList($domain, "own", 100, $num ) ) { foreach($ret as $file) { $fil...原创 2014-07-21 17:13:33 · 813 阅读 · 0 评论 -
php foreach正序倒序输出
// 正序foreach($files as $file_num => $file) { if(is_file($directory.$file)){ //$file = iconv("gb2312","UTF-8",$file); //或者 iconv("gb2312","UTF-8",$value); $date = substr($file,0,9); e...原创 2014-06-21 09:53:43 · 1376 阅读 · 0 评论 -
php this、self、parent区别
1、this是指向当前对象的指针如:同class里面的其他函数可以用 this->函数名 调用。2、self是指向当前类的指针一般self使用来指向类中的静态变量,还要注意使用self来调用静态变量必须使用:: (域运算符号)如:self::$firstCount; //使用self来调用静态变量3、parent是指向父类的指针一般我...原创 2014-05-20 11:55:42 · 116 阅读 · 0 评论 -
php-html 动态表格分行-数据结构剖析
$files = scandir('.');echo '<table align="center" border="1" cellpadding="5" cellspacing="0" width="800" style="min-width:444px;">';$counter = 1;$each_columns = 4;foreach($f原创 2014-05-16 11:41:53 · 171 阅读 · 0 评论 -
php精确判断是否为索引数组
function is_assoc($arr){ return array_keys($arr) !== range(0, count($arr) - 1); // array_values($arr) !== $arr}function is_assoc2($array) { return (bool)count(array_filter(array_keys($...原创 2014-05-07 16:09:24 · 818 阅读 · 0 评论 -
php获取本机ip或远程地址
// 111111111111echo $_SERVER['REMOTE_ADDR'];// 2222222222222function get_local_ip() { $preg = "/\A((([0-9]?[0-9])|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.){3}(([0-9]?[0-9])|(1[0-9]{2})...原创 2014-05-04 17:26:38 · 382 阅读 · 0 评论 -
php判断字符串是否存在
解决方法:使用 === or !==if(stripos($sql, "insert") === 0){ $excuteResult = mysql_query($sql); if($excuteResult){ $sql = $sql2."where id = (select max(id) from subway2)"; } } else if...原创 2014-04-30 16:16:47 · 262 阅读 · 0 评论 -
php读取mysql中文乱码解决
<!DOCTYPE><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>数据测试</title></head><原创 2014-04-29 14:54:02 · 386 阅读 · 0 评论 -
php读取sqlite入门版
<?php//打开sqlite数据库//$db = @sqlite_open("MM.sqlite", 0666, $error); // 不支持$db = new PDO('sqlite:MM.sqlite');//异常处理if (!$db) die("Connection Sqlite failed.\n");//添加一个叫做foo的数据库//@sqlit...原创 2013-10-04 16:08:05 · 277 阅读 · 0 评论 -
php读取mysql入门版
<?php$hostname = "localhost:3306";$username = "root";$password = "root";$dbname = "test";$conn = mysqli_connect($hostname, $username, $password, $dbname);$conn->query("SET NAMES '...原创 2013-10-04 16:07:06 · 101 阅读 · 0 评论