php达成读取和写入tab分割的文书_php本领_脚本之家
分类:long8

// Define a dummy text, for testing...$Text = "Title: Hello world!n";$Text .= "Author: Jonasn";$Text .= "This is a example message!nn";$Text .= "Title: Entry 2n";$Text .= "Author: Sonjan";$Text .= "Hello world, what's up!n";// This function will replace specific matches// into a new formfunction RewriteText{ // Entire matched section: // --> /.../ $EntireSection = $Match[0]; // --> "nTitle: Hello world!" // Key // -->  $Key = $Match[1]; // --> "Title" // Value // -->  $Value = $Match[2]; // --> "Hello world!" // Add some bold  tags to around the key to return '' . $Key . ': ' . $Value;}// The regular expression will extract and pass all "key: value" pairs to// the "RewriteText" function that is definied above$NewText = preg_replace_callback: /i', "RewriteText", $Text);// Print the new modified textprint $NewText;

正文实例呈报了php完成读取和写入tab分割的文件。分享给大家供大家参谋。具体深入分析如下:

long8,本文实例呈报了php从文件夹随机读取文件的方式。分享给我们供大家参谋。具体贯彻格局如下:

/** * Calculate the full size of a directory * * @author Jonas John * @version 0.2 * @link http://www.jonasjohn.de/snippets/php/dir-size.htm * @param string $DirectoryPath Directory path */function CalcDirectorySize { // I reccomend using a normalize_path function here // to make sure $DirectoryPath contains an ending slash // (-> http://www.jonasjohn.de/snippets/php/normalize-path.htm) // To display a good looking size you can use a readable_filesize // function. // (-> http://www.jonasjohn.de/snippets/php/readable-filesize.htm) $Size = 0; $Dir = opendir; if  return -1; while () !== false) { // Skip file pointers if  continue; // Go recursive down, or add the file size if (is_dir($DirectoryPath . $File)) $Size += CalcDirectorySize($DirectoryPath . $File . DIRECTORY_SEPARATOR); else $Size += filesize($DirectoryPath . $File); } closedir; return $Size;}//使用范例:$SizeInBytes = CalcDirectorySize;

php达成读取和写入tab分割的文书_php本领_脚本之家,php总计整个目录大小的不二诀窍_php技艺_脚本之家。本文实例陈诉了php获取系统变量的主意。分享给大家供大家参谋。具体如下:

本文由long8发布于long8,转载请注明出处:php达成读取和写入tab分割的文书_php本领_脚本之家

上一篇:php中smarty区域循环的艺术_php实例_脚本之家【lo 下一篇:cU猎豹CS6L开端化和试行措施入门级代码_php实例
猜你喜欢
热门排行
精彩图文