mirror of https://github.com/helloxz/imgurl.git
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							37 lines
						
					
					
						
							1.2 KiB
						
					
					
				
			
		
		
	
	
							37 lines
						
					
					
						
							1.2 KiB
						
					
					
				| <?php | |
|     /* | |
|         name:页面 | |
|     */ | |
|     defined('BASEPATH') OR exit('No direct script access allowed'); | |
| 
 | |
|     class Page extends CI_Controller{ | |
|         public function _remap($name){ | |
|             //获取URI | |
|             $name = strip_tags($name); | |
|              | |
|             //查找文件 | |
|             $pagefile = FCPATH.'data/pages/'.$name.'.md'; | |
|             $pagefile = str_replace('\\','/',$pagefile); | |
|              | |
|             //如果文件不存在,直接返回404 | |
|             if(!is_file($pagefile)){ | |
|                 show_404(); | |
|             } | |
|             //读取文件内容 | |
|             $content = file_get_contents($pagefile); | |
|             //载入markdown解析类 | |
|             $this->load->library("parsedown"); | |
|             $content = $this->parsedown->text($content); | |
| 
 | |
|             //$data['content'] = $content; | |
|             //加载数据库视图 | |
|             $this->load->model('query','',TRUE); | |
|             $data = $this->query->site_setting('1'); | |
|             $data->content = $content; | |
|             //载入页面视图 | |
|             $this->load->view('/user/header',$data); | |
|             $this->load->view('/user/page',$data); | |
|             $this->load->view('/user/footer'); | |
|         } | |
|     } | |
| ?>
 |