/** * 这是生成sitemapindex的第二部 */ public function sitemapIndex($filename) { $indexStr = $this->xmlHeader; $indexStr .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . $this->sitemapItem . '</sitemapindex>'; if (!file_exists(dirname($filename))) { LJL_File::mkdir(dirname($filename)); } file_put_contents($filename, $indexStr); $this->sitemapItem = ''; unset($indexStr); }
public function DoUploadImg(LJL_Request $input, LJL_Response $output) { $upfile = $input->files('uppic'); //客户端传过来的文件 $pos = strpos($upfile['name'], '.') + 1; $ext = substr($upfile['name'], $pos); //获取后缀名 $typelist = array("gif", "jpg", "png"); //限制图片类型 $imgInfo = LJL_Api::run("Image.DFS.imgStorage", array('rootdir' => UPLOAD_IMG_PATH . 'blog_' . APP_BLOG_NAME . '/')); $path = $imgInfo[2]; //上传到该文件夹 $webPath = Helper_Blog::getImgWebPath($imgInfo[2]); if (!is_dir($path)) { LJL_File::mkdir($path); } //获取图片名 $picName = $imgInfo[0]; $result = $this->uploadFile($upfile, $path, $picName, $webPath, $typelist); //图片上传函数 if ($result['status']) { //图片表中插入数据 $imgid = Helper_Blog::insertPic(array('picName' => $picName, 'picExt' => $ext, 'time' => $imgInfo[1])); echo '<script language="javascript">window.parent.addPic("' . $result['info'] . '","' . $imgid . '");</script>'; } else { echo '<script language="javascript">window.parent.addPic("error","0");</script>'; } }
private function getImgNameDir() { $imgInfo = LJL_Api::run("Image.DFS.imgStorage", array('rootdir' => $this->uploadRootdir . $this->website . '/')); $picName = $imgInfo[0]; // 0/1时间/2 $path = $imgInfo[2]; //上传到该文件夹 $webPath = $this->getImgWebPath($imgInfo[2]); if (!is_dir($path)) { LJL_File::mkdir($path); } return array($picName, $path, $webPath, $imgInfo[1]); }