⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 query.php

📁 ajax php wiki source code
💻 PHP
字号:
<?php

function latest_content() {
	$files = glob("data/*.html");
	if (count($files) == 0)
		return '';

	rsort ($files, SORT_STRING);
	return file_get_contents($files[0]);
}

$action = $_REQUEST["action"];

if (!$action || $action == "latest") {

	echo latest_content();

} else if ($action == "draft") {
	if (file_exists("data/.draft.html")) {
		echo file_get_contents("data/.draft.html");
	} else {
		echo latest_content();
	}
} else if ($action == "history") {
	$files = glob("data/*.html");
	rsort($files, SORT_STRING);
	foreach ($files as $f) {
		if ($f != ".draft.html") {
			printf ("%s\n", $f);
		}
	}
} else if ($action == "file") {
	$fname = $_REQUEST['filename'];
	if (file_exists($fname)) {
		$content = file_get_contents($fname);
		echo $content;
	}
} 

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -