private function getRandomPic1() { loadPics(); $keys = $this->site->getSiteKeys($this->site->host); $i = rand(0, count($_SERVER['cfg_pics']) - 1); if (!isset($_SERVER['cfg_pics'][$i])) { return '网站图片库为空,请检测!'; } $images = $_SERVER['cfg_pics'][$i]; $j = mt_rand(0, count($keys) - 1); $url1 = 'http://' . $this->site->host . '/'; $url2 = weburl($this->site->host, 'read', $j); $num = sizeof(scandir("./text")); $num = $num > 2 ? $num - 2 : 0; $suzi = mt_rand(1, $num); $text = get_lines_by_php('Text/Text_' . $suzi . '.php'); $i = mt_rand(0, count($text) - 1); $wzbt = $text[$i]; if (mt_rand(1, 2) == 1) { $title = $keys[$j]; $url2 = 'http://' . $this->site->host . '/' . py($title, 1) . '_' . $j . '.html'; //return '<a href="' . $url2 . '" target="_blank"><img src="' . $url1 . '' . $images . '" title="' . $wzbt . '' . $keys[$j] . '" /></a><br><a href="' . $url2 . '" target="_blank">' . $wzbt . '' . $keys[$j] . '</a>'; return '<a href="' . $url2 . '" target="_blank"><img src="' . $url1 . '' . $images . '" title="' . $keys[$j] . '" /></a><br><a href="' . $url2 . '" target="_blank">' . $keys[$j] . '</a>'; } else { $title = $wzbt; $url2 = 'http://' . $this->site->host . '/' . py($title, 1) . '_' . $j . '.html'; // return '<a href="' . $url2 . '" target="_blank"><img src="' . $url1 . '' . $images . '" title="' . $keys[$j] . '' . $wzbt . '" /></a><br><a href="' . $url2 . '" target="_blank">' . $keys[$j] . '' . $wzbt . '</a>'; return '<a href="' . $url2 . '" target="_blank"><img src="' . $url1 . '' . $images . '" title="' . $wzbt . '" /></a><br><a href="' . $url2 . '" target="_blank">' . $wzbt . '</a>'; } }
function load($fmt = null) { global $fh; if ($fmt == null) { $fmt = "<img src='%s' />"; } foreach (loadPics() as $pic) { echo sprintf($fmt, $pic); } fclose($fh); }