zoukankan      html  css  js  c++  java
  • 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'=>'',
    
    );
    ?>
    


    
    
    
       
    
    
  • 相关阅读:
    sql 生成开始日期到结束日期相差天数或日期
    自定义表做存储过程变量
    [转]html 移动互联网终端的javascript touch事件,touchstart, touchend, touchmove
    [转]JQuery.Ajax之错误调试帮助信息
    解决IOS safari在input focus弹出输入法时不支持position fixed的问题
    查看 存储过程的执行时间
    ListView
    android矩阵详解
    跳出圈子 “莫忘初心,方得始终”
    Eclipse使用
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6200228.html
Copyright © 2011-2022 走看看