[AppleScript] 纯文本查看 复制代码
function dir_recurse($dir) {
$i = 1;
if($handle = opendir($dir)) {
while(false !== ($file = readdir($handle))) {
if($file != "."&& $file != ".." ) {
if(is_dir($dir."/".$file) == true) {
$fullpath = $dir."/".$file;
dir_recurse($fullpath);
echo "$fullpath\n";
$i++;
}else {
$fullpath = $dir."/".$file;
echo "$fullpath\n";
$i++;
}
}
}
closedir($handle);
}
}
[AppleScript] 纯文本查看 复制代码
function my_scandir($dir){
$files = array();
if ( $handle = opendir($dir) ) {
while ( ($file = readdir($handle)) !== false ) {
if ( $file != ".."&& $file != "." ) {
if ( is_dir($dir . "/" . $file) ) {
$files[$file] = scandir($dir . "/" . $file);
}else {
$files[] = $file;
}
}
}
closedir($handle);
return $files;
}
}
[PHP] 纯文本查看 复制代码
$link = mysql_connect("localhost","root","root"); mysql_select_db("test",$link); $sql ="select * from table";
$result = mysql_query($sql);
while($row =mysql_fetch_****($result) ){
$arr[]=$row;
}
$row = mysql_fetch_array($result) 意思:$row['name'] 和$row[1] 都可以取到值
$row = mysql_fetch_row($result)) 意思:$row[1] 只有用索引取值,偏移量从 0 开始。
$row = mysql_fetch_assoc($result)) 意思: $row['name'] 字段名作为索引取值 抽取一条记录转为 关联数组,失败返回 false