• php mvc 框架演示


    <pre name="code" class="cpp"><pre name="code" class="python">tpl:
    
    class EnvAction extends Action
    
    类 EnvAction  继承Action类
    
    class EnvAction extends Action {
    	// class Index extends Action {
        public function index(){
    	// $this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;} h1{ font-size: 100px; font-weight: 
    
    normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p></div><script type="text/javascript" 
    
    src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
    	echo helloworldaaaaaaa;
    	$name="赵杨健";
    	$this->assign('data',$name);
    	$this->display();
    	}
        public function env(){
    	$m=new Model('machine_info'); //传入表名
    	$arr=$m->select();
    	var_dump($arr);
    	
    
        }
    
    $this->display(); 输出的内容存放的位置:
    
    需要在C:wampwww	hinkphpHomeTpl
    
    下创建Env(模块名)目录
    
    在类名目录下创建方法名.html
    
    env.html	
    
    <!doctype html>
    <html lang="en">
     <head>
      <meta charset="UTF-8">
      <meta name="Generator" content="EditPlus®">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <title>Document</title>
     </head>
     <body>
     <h1>helloworld {$data}</h1>
     </body>
    </html>
    
    
    
    
    通过C 调用V层模板 V层模板数据调用M层来获取数据
    
    
    M  mod类文件 负责对数据的操作 项目目录/应用目录/Lib/Model
    
    C  功能模块  编写类文件 项目目录/应用目录/Lib/Action
    
    
    V  负责页面呈现 编写模板文件 html文件 对应thinkphp 项目目录下/应用目录 Home/Tpl
    
    <?php
    return array(
    'DB_TYPE'=>'mysql',
    
    'DB_HOST'=>'192.168.32.79',
    'DB_NAME'=>'devops',
    'DB_USER'=>'root',
    'DB_PWD'=>'1234567',
    'DB_port'=>'3306',
    'DB_PREFIX'=>'',
    
    );
    ?>
    


    
    
    
       
    
    
  • 相关阅读:
    DML-DDL-DCL
    FastDFS常见场景模拟
    如何定义软件版本
    鸟哥的linux私房菜学习-(七)改变文件属性与权限
    鸟哥的linux私房菜学习-(六)Linux 文件权限介绍
    二、基本语法
    一、JavaSE语言概述
    鸟哥的linux私房菜学习-(五)补充:重点回顾
    鸟哥的linux私房菜学习-(五)Linux系统的在线求助man page与info page
    鸟哥的linux私房菜学习-(四)linux命令的基本概念
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6200228.html
Copyright © 2020-2023  润新知