基于MVC设计模式实现简单PHP框架(雏形)-初期

2023-05-16

(记住:这里只是提供思考的过程)

       其实这里只是一个我们课的Web实验”课程设计题目统计系统“,在做实验的过程中起初只是想往MVC靠拢而已,却不知不觉地“实现”了基于MVC的简单框架的雏形,可能这个框架雏形还有许多BUG(毕竟这只是一个“简单”的框架而已嘛,勿喷),望读者发现后能够指出,谢谢。

       该雏形并不是单一入口框架,后续还将进行修改。

       这里列出的是,我做实验过程中的一些实验体会和遇到的问题:

(1) 如何将存在于控制器中的display模板呢?(参考:http://www.3lian.com/edu/2015/06-18/222798.html

我们可以使用 include 的方式引入模板,显示视图。

 

(2) 这里遇到了一个问题:include 引入模板文件时,我使用了如 include '../showStudent.php?info=add' 的方式,结果出现了寻找不到该文件的提示,起初我以为是因为路径搞错了的原因,经过不上10几次的修改测试,最后才意识到:include文件时应该不能传递参数吧(参考: http://zhidao.baidu.com/link?url=jUrghtWyr0YljXb3rIg4aimd8_0qxq29Vqe2XMCNJQM35KLBBlIT6SUhaX82aTolSuifwRBIKHSSyTI4jbHbs_ )。是的,仔细想想,就能明白include只是用于引入文件而已,不是传递GET参数,这样当然会出错咯。我自己搞笑了。如果要传递参数,那么可以改成在include设置好变量的值不就行啦。

 

(3) 我们如何将变量注册到模板上呢(控制器中的变量让模板进行使用)?

参考:php模板技术php是怎么向模板中传值的呢? http://zhidao.baidu.com/link?url=QhJKIykE8puBK82S7pW_nPzR8pMTf_tNILdG06sAgEMHQhm9bdVnjS1X4lUT68yJOLvyrILl9KixFHkVR4nSs_ )

刚才已经知道了,我们可以include 文件的方式引入模板,那么我们只要在include之前定义好变量,我们就可以在模板文件中“名正言顺”地使用这些变量了。注册变量到模板的实现,可以查看一下我的源码。

 

(4) 注册变量到模板的过程与ThinkPHP的方式类似,实现的话,我目前没去查看ThinkPHP源码进行比较。我这里的实现需要使用到一个 PHP函数——extract()(参考: http://www.w3school.com.cn/php/func_array_extract.asp )

extract() 函数从数组中将变量导入到当前的符号表。

实例

将键值 "Cat""Dog" "Horse" 赋值给变量 $a$b $c

<?php

$a = "Original";

$my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse");extract($my_array);

echo "\$a = $a; \$b = $b; \$c = $c";

?>

那么我们就可以使用,一个assign注册方法,提供传入两个参数,第1个参数为使用在模板上的变量名 key,第2个参数为该变量的值 value。先以 key=>value的方式,存入到数组中,到需要显示模板的时候,我们就可以通过extract()方法将其转化为变量,变量名为key的值,变量的值为value

 

(5)实现分页过程中:mysqlorderbylimit同时使用的bug(参考:http://blog.sina.com.cn/s/blog_705cc5dd01012ehb.html )

起初我的SQL语句是这样的:SELECT * FROM students LIMIT 0,20 ORDER BY sno,结果报错,应该修改为:SELECT * FROM students ORDER BY sno LIMIT 0 , 20。

 

6)单一入口框架(参考: http://blog.csdn.net/qq_15096707/article/details/50766755 )



关键代码:

基本控制器类 Controller.class.php (所有自定义的控制器都将继承于该类)

<?php 
	class Controller {
		const TPL_PATH = '../'; //当前控制器与模板的相对位置(实际上可以该在配置文件上)
		private $data = array(); //保存注册到模板上的变量

		/**
		 * 验证变量是否存在,是否为空
		 * @param  [type] $v [需要进行验证的变量]
		 * @return [type]    [true | false]
		 */
		function validate($v) {
			if(!isset($v) || empty($v)) return false;
			return true;
		}
		/**
		 * 重定向
		 * @param  [type] $url [重定向的URL地址]
		 * @return [type]      [description]
		 */
		function redirect($url) {
			header('Location:' . self::TPL_PATH .$url);
			exit;
		}

		/**
		 * 注册模板上的变量
		 * @param  [type] $key   [应用在模板上的变量名]
		 * @param  [type] $value [变量对应的值]
		 * @return [type]        [当前对象的引用,提供链式写法]
		 */
		function assign($key, $value) {
			$this->data[$key] = $value;
			return $this;
		}

		/**
		 * 显示page模板
		 * @param  [type] $page [模板的名称]
		 * @return [type]       [description]
		 */
		function display($page) {
			if($this->validate($this->data)) {
				extract($this->data);
				$this->data = array();
			}
			
			include self::TPL_PATH . $page;
		}
	}
?>

基本模型类Model.class.php(所有自定义的模型类都将继承于该类)

<?php 
	require_once 'SqlHelper.class.php';

	class Model {
		private $sqlHelper;

		function __construct() {
			$this->sqlHelper = new SqlHelper();
		}

		function execute_dql_res($sql) {
			return $this->sqlHelper->execute_dql_res($sql);
		}

		function execute_dql_arr($sql) {
			return $this->sqlHelper->execute_dql_arr($sql);
		}

		function execute_dml($sql) {
			return $this->sqlHelper->execute_dml($sql);
		}
	}
?>
数据库操作类 SqlHelper.class.php

<?php 
	class SqlHelper {
		private $mysqli;

		private $host = 'localhost';
		private $user = 'root';
		private $pwd = '123';
		private $db = 'test';
		private $port = 3306;

		public function __construct() {
			//完成初始化任务
			if(defined('SAE_MYSQL_DB')) { //判断是否是云平台
				$this->host = SAE_MYSQL_HOST_M;
				$this->user = SAE_MYSQL_USER;
				$this->pwd = SAE_MYSQL_PASS;
				$this->db = SAE_MYSQL_DB;
				$this->port = SAE_MYSQL_PORT;
			}

			$this->mysqli = new MySQLi($this->host, $this->user, $this->pwd, $this->db, $this->port);

			if($this->mysqli->connect_error) {
				die('连接失败' . $this->mysqli->connect_error);
			}
			//设置访问数据库的字符集
			//这句话的作用是保证php是以utf8的方式来操作我们的mysql数据库
			$this->mysqli->query("SET NAMES utf8") or die($this->mysqli->error);
		}

		public function execute_dql_res($sql) {
			$res = $this->mysqli->query($sql) or die('操作dql失败' . $this->mysqli->error);
			return $res;
		}

		public function execute_dql_arr($sql) {
			$arr = array();
			$res = $this->mysqli->query($sql) or die('操作dql失败' . $this->mysqli->error);

			while($row = $res->fetch_assoc()) {
				$arr[] = $row;
			}

			$res->free_result();
			return $arr;
		}

		public function execute_dml($sql) {
			$res = $this->mysqli->query($sql)/* or die('操作dml失败' . $this->mysqli->error)*/;

			if(!$res) {
				return 0; //表示失败
			} else {
				if($this->mysqli->affected_rows > 0) {
					return 1; //表示成功
				} else {
					return 2; //表示没有行受到影响
				}
			}
		}

		public function __destruct() {
			$this->mysqli->close();
		}
	}
?>

下面是基于这个雏形的实验代码(界面采用了Bootstrap框架):

目录结构如下:


实验运行结果:




input.php

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>课程设计题目统计系统</title>

    <!-- Bootstrap -->
    <link href="/Lab6/Lab6_1/Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Lab6/Lab6_1/Public/style.css" rel="stylesheet" type="text/css"/>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <div class="container">
      <div class="col-sm-3"></div>
      <div class="col-sm-6 content">
        <h2>课程设计题目统计系统</h2>
        <form class="form-horizontal" action="Controller/InputController.php" method="POST">
          <div class="form-group">
            <label for="number" class="col-sm-3 control-label">学生学号:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="number" placeholder="输入12位学号" name="sno">
            </div>
          </div>
          <div class="form-group">
            <label for="name" class="col-sm-3 control-label">学生姓名:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="name" placeholder="姓名" name="name">
            </div>
          </div>
          <div class="form-group">
            <label for="password" class="col-sm-3 control-label">修改密码:</label>
            <div class="col-sm-9">
              <input type="password" class="form-control" id="password" placeholder="首次输入作为后面修改的密码" name="psw">
            </div>
          </div>
          <div class="form-group">
            <label for="title" class="col-sm-3 control-label">你的题目:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="title" placeholder="按照课程设计题目要求" name="title">
            </div>
          </div>
          <div class="form-group">
            <label for="name" class="col-sm-3 control-label">合作学生:</label>
            <div class="col-sm-9">
              <input type="text" class="form-control" id="name" placeholder="姓名,没有就空,只负责不同方面" name="partner">
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-3 col-sm-9">
                <label>
                  <input type="radio" name="action" value="add"  checked="checked"> 新增题目
                </label>
                  
                <label>
                  <input type="radio" name="action" value="modify"> 修改试题
                </label>
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-3 col-sm-9">
              <button type="submit" class="btn btn-info">提交操作</button>   
              <a href="Controller/showController.php">显示全部学生题目</a>
            </div>
          </div>
          <?php
            $err = array('sno'=>'学生学号不能为空!', 'name'=>'学生姓名不能为空!', 'psw'=>'修改密码不能为空', 'title'=>'题目标题不能为空!', 'add'=>'新增题目失败,原因可能为已新增过题目了,请尝试选择“修改试题”进行提交!', 'modify'=>'修改试题失败,原因可能为:1.未新增过题目;2.学生学号输入错误;3.修改密码输入错误!');
            if($_GET['err']) {
          ?>
               <p class="info"><span style="font-weight: bold">错误:</span><?php echo $err[$_GET['err']];?></p>
          <?php
            }
          ?>
        </form>
      </div>
      <div class="col-sm-3"></div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="/Lab6/Lab6_1/Public/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="/Lab6/Lab6_1/Public/js/bootstrap.min.js"></script>
  </body>
</html>

showStudent.php

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
    <title>课程设计题目统计系统</title>

    <!-- Bootstrap -->
    <link href="/Lab6/Lab6_1/Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Lab6/Lab6_1/Public/style.css" rel="stylesheet" type="text/css"/>
    <style>
      p.info {
        margin-bottom: 0;
      }
    </style>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
	<div class="container">
      <div class="content">
        <?php
          if($info) {
            if($info == 'add') {
              $fo = '新增';
            } else if($info == 'modify') {
              $fo = '修改';
            }
        ?>
             <p class="info"><marquee behavior="scroll" direction="left"><span style="font-weight: bold">消息:</span><?php echo $fo . '题目成功!';?></marquee></p>
        <?php
          }
        ?>
        
        <table class="table table-hover">
          <caption><h3>学生课程设计题目</h3></caption>
          <?php
            if(!isset($res) || empty($res)) {
              echo '<tr><td>暂无学生题目</td></tr>';
            } else {
          ?>
          <thead>
            <tr>
              <!-- <th>删除</th> -->
              <th>序号</th>
              <th>学号</th>
              <th>姓名</th>
              <th>题目</th>
              <th>状态</th>
              <th>录入时间</th>
              <th>合作学生</th>
            </tr>
          </thead>
          <tbody>
            <?php
              $i = $start ? $start : 1;
              foreach ($res as $value) {
                echo '<tr>';
                echo "<th scope='row'>$i</th>";
                echo "<td>{$value['sno']}</td>"; 
                echo "<td>{$value['name']}</td>"; 
                echo "<td>{$value['title']}</td>"; 
                echo "<td>{$value['state']}</td>"; 
                echo "<td>{$value['last_time']}</td>"; 
                echo "<td>{$value['partner']}</td>"; 
                echo '</tr>';
                $i++;
              }
            ?>
          </tbody>
          <?php
            }
          ?>
        </table>
        <nav>
          <ul class="pager">
            <li>
              <?php
                if($prePage) {
                  if($prePage >= 1) {
                    echo "<a href='showController.php?cur=$prePage'>上一页</a>";
                  }
                }
              ?>
            </li>
            <li>
              <?php
                if($nextPage) {
                  if($nextPage >= 1) {
                    echo "<a href='showController.php?cur=$nextPage'>下一页</a>";
                  }
                }
              ?>
            </li>
          </ul>
        </nav>
        <a href="/Lab6/Lab6_1/input.php">返回输入界面</a>
      </div>
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="/Lab6/Lab6_1/Public/js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="/Lab6/Lab6_1/Public/js/bootstrap.min.js"></script>
  </body>
</html>

style.css

body {
  font-family: "微软雅黑", "Microsoft YaHei";
  background-color: #E8DDCB;
}
.content {
  border: 1px solid #DDD;
  border-radius: 5px;
  box-shadow: 0 0 5px #ABCEDF;
  padding: 0 20px 20px;
  background-color: #FFF;
  
  margin: 50px 0;
  filter:alpha(opacity=100);  /* ie 有效*/
  -moz-opacity: 1; /* Firefox  有效*/
  opacity: 1; /* 通用,其他浏览器  有效*/

  animation: contentAnim 1s;
  -moz-animation: contentAnim 1s; /* Firefox */
  -webkit-animation: contentAnim 1s;  /* Safari 和 Chrome */
  -o-animation: contentAnim 1s; /* Opera */
}
.content h2 {
  text-align: center;
  margin: 30px 0;
}

@keyframes contentAnim {
  from {margin-top: 300px; filter:alpha(opacity=0); -moz-opacity: 0; opacity: 0;}
  to {margin-top: 50px; filter:alpha(opacity=100); -moz-opacity: 1; opacity: 1;}
}

@-moz-keyframes contentAnim { /* Firefox */ 
  from {margin-top: 300px; filter:alpha(opacity=0); -moz-opacity: 0; opacity: 0;}
  to {margin-top: 50px; filter:alpha(opacity=100); -moz-opacity: 1; opacity: 1;}
}

@-webkit-keyframes contentAnim { /* Safari 和 Chrome */ 
  from {margin-top: 300px; filter:alpha(opacity=0); -moz-opacity: 0; opacity: 0;}
  to {margin-top: 50px; filter:alpha(opacity=100); -moz-opacity: 1; opacity: 1;}
}

@-o-keyframes contentAnim { /* Opera */ 
  from {margin-top: 300px; filter:alpha(opacity=0); -moz-opacity: 0; opacity: 0;}
  to {margin-top: 50px; filter:alpha(opacity=100); -moz-opacity: 1; opacity: 1;}
}

p.info {
  margin: 20px 0;
  padding: 10px 30px;
  background-color: #E8DDCB;
  border: 1px solid #CCC;
  border-radius: 5px;
}

基本控制器类Controller.class.php 和 基本模型类 Model.class.php 在上面已经列出。

InputController.class.php

<?php
	require_once 'Controller.class.php';
	require_once '../Model/StudentModel.class.php';

	class InputController extends Controller {
		protected $required = array('sno'=>'学生学号不能为空!', 'name'=>'学生姓名不能为空!', 'psw'=>'修改密码不能为空', 'title'=>'题目标题不能为空!');

		function check() {
			foreach ($this->required as $key => $value) {
				if(!$this->validate($_POST[$key])) {
					$this->redirect('input.php?err=' . $key);
				}
			}
		}

		function doAction() {
			if($this->validate($_POST['action'])) {
				if($_POST['action'] == 'add') {
					$this->add();
				} else {
					$this->modify();
				}
			}
		}

		function add() {
			$studentModel = new StudentModel();
			if($studentModel->add()) {
				$this->assign('info', 'add')->show();
			} else {
				$this->redirect('input.php?err=add');
			}
		}

		function modify() {
			//echo 'modify';
			$studentModel = new StudentModel();
			if($studentModel->modify()) {
				$this->assign('info', 'modify')->show();
			} else {
				$this->redirect('input.php?err=modify');
			}
		}

		function show() {
			$studentModel = new StudentModel();
			$cur = 1; //当前页数第一页
			if($this->validate($_GET['cur'])) {
				$cur = $_GET['cur'];
			}
			$res = $studentModel->page($cur);
			$this->assign('res', $res)->assign('start', ($cur-1) * $studentModel->getEachPageLen() + 1)->assign('prePage', $cur-1)->assign('nextPage', $cur+1)->display('showStudent.php');
		}
	}
?>

inputController.php

<?php
	require_once 'InputController.class.php';

	$inputC = new InputController();
	$inputC->check();
	$inputC->doAction();
?>

showController.php

<?php
	require_once 'InputController.class.php';

	$inputC = new InputController();
	$inputC->show();
?>


StudentModel.class.php

<?php 
	require_once 'Model.class.php';

	class StudentModel extends Model {
		private $eachPageLen = 15;

		//新增数据
		function add() {
			$sno = $_POST['sno'];
			$name = $_POST['name'];
			$psw = $_POST['psw'];
			$title = $_POST['title'];
			$partner = $_POST['partner'];

			$sql = "INSERT INTO students(`sno`, `name`, `psw`, `title`, `last_time`, `partner`) VALUES('$sno', '$name', '$psw', '$title', now(), '$partner')";

			$res = $this->execute_dml($sql);
			if($res == 1) {
				return 1; //新增题目成功
			} else {
				return 0; //新增题目失败
			}
		}

		//修改数据
		function modify() {
			$sno = $_POST['sno'];
			$psw = $_POST['psw'];
			$title = $_POST['title'];
			$partner = !isset($_POST['partner']) || empty($_POST['partner']) ? '' : $_POST['partner'];

			$sql = "UPDATE students SET `title` = '$title', `partner` = '$partner' WHERE `sno` = '$sno' AND `psw` = '$psw'";

			$res = $this->execute_dml($sql);
			if($res == 1) {
				return 1; //修改题目成功
			} else {
				return 0; //修改题目失败
			}
		}

		//分页查询数据
		function page($cur) {
			$length = $this->eachPageLen;
			$offset = ($cur - 1) * $length;
			$sql = "SELECT * FROM students ORDER BY sno LIMIT $offset,$length";
			return $arr = $this->execute_dql_arr($sql);
		}
		//得到每页的页数
		function getEachPageLen() {
			return $this->eachPageLen;
		}
	}
?>


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

基于MVC设计模式实现简单PHP框架(雏形)-初期 的相关文章

  • PHP 中的多个插入查询[重复]

    这个问题在这里已经有答案了 我正在尝试创建一个 php html 表单 它将结果插入到狗展数据库中 问题是 无论我做什么 我都会收到此错误 查询失败 您的 SQL 语法有错误 检查与您的 MySQL 服务器版本相对应的手册 了解在 INSE
  • 谷歌日历手表过期时间超过1个月怎么办?

    我将我的 CRM 系统与 Google 日历同步 为此 我要求push notifications从我的用户 Google 日历到我的系统 我已经成功创建了手表 并将过期时间设置为2030年 但是当我收到手表事件的响应时 它显示手表的过期时
  • 如何在 Carbon Laravel 中添加日期和另一个日期?

    在我的 laravel 项目中 我想将日期时间增加到前一个日期时间 这是我的代码 expire order 0 gt expire date new Carbon now gt addMonths 6 这两行的结果是 2018 01 28
  • 如何在数据列表 HTML PHP 中设置选择

    您好我想知道是否有一种方法可以在数据列表中设置选定的值 我想要这样的东西
  • PHP 正则表达式匹配字符串的最后一次出现

    我的字符串是 text1 A373R12345 我想找到该字符串最后出现的非数字数字 所以我使用这个正则表达式 0 9 然后我得到这个结果 1 A373 2 12345 但我的预期结果是 1 A373R 它有 R 2 12345 另一个例子
  • MySQL 和 PHP 参数 1 作为资源

    好吧 当我运行下面提到的代码时 PHP 向我抛出此错误 在日志中 Error mysql num rows 期望参数 1 为资源 第 10 行 place 中给出的字符串 9 11号线 queryFP SELECT FROM db coun
  • 发送变量后的 wsdl 服务响应,php

    我是 SOAP WSDL 函数的新手 我有一位客户从一家从事汽车测试的公司获得了 wsdl 文件 我的客户是他们的分包商 他们告诉我们上传有关车牌 类别等信息 一旦详细信息发送完毕 服务器就会做出成功或失败的响应 请您协助 浏览不同的信息
  • 使用 phpdocx 下载损坏的 .docx

    我有一个项目 我们使用 phpdocx pro 在模板中生成 docx 文件 我可以很容易地将数据输入到模板中 但是当下载文件并在 MS Word 2010 中打开时 程序报告无法打开文件 因为内容存在问题 详细信息是 文件已损坏 并且无法
  • 收到警告“标头不能包含多个标头,检测到新行”

    我正在用 oops 进行编码 以便用 PHP 上传图像 但是提交图片后却出现警告 标题不能包含多个标题 检测到新行 下面是我的函数 它给出了错误 public function ft redirect query if REQUEST UR
  • 自定义帖子类型的 WordPress 自定义字段

    过去有几个人出现过这个问题 但他们的问题的解决方案对我来说不起作用 我已经尝试了很多 在 WordPress 中 我创建了 3 种自定义帖子类型 1 代表 视频 新闻 和 音乐 每个内容都发布到自己的页面 我想添加自定义字段 这样我就可以为
  • Laravel - 急切加载 Eloquent 模型的方法(而不是关系)

    就像我们可以急切加载 Eloquent 模型的关系一样 有没有办法急切加载不是 Eloquent 模型的关系方法的方法 例如 我有一个 Eloquent 模型GradeReport它有以下方法 public function totalSc
  • 将查询字符串附加到任何形式的 URL

    我要求用户在文本框中输入 URL 并需要向其附加查询字符串 URL 的可能值如下 http www example com http www example com http www example com a http www examp
  • yii2 中的自动完成

    在 Yii2 中 我希望当用户开始输入时 我的输入字段之一能够自动完成 下面是我的代码 它使用Jui Autocomplete 这是行不通的 当我打印我的数组时 我就像 Array 1 gt abc 2 gt xyz 4 gt pqr
  • 从 php 执行 bash 脚本并立即输出回网页

    我有一组 bash 和 Perl 脚本 开发在 Linux Box 上部署所需的目录结构 可选 从svn导出代码 从这个源构建一个包 这在终端上运行良好 现在 我的客户请求此流程的 Web 界面 例如 某些页面上的 创建新包 按钮将一一调用
  • PHP-docker容器中的环境变量

    我想在我的 docker 容器中显示一个环境变量 PHP 脚本如下所示 我使用 OpenShift 来启动容器 PHP 容器显示 env is 现在我更改容器的 dc 配置 oc env dc envar USER Pieter deplo
  • 付款成功后保存到数据库(paypal)

    我试图找出在客户使用 paypal 支付商品费用后将数据 之前以表单提交 保存到数据库的最佳方法 沿着这个过程的一些事情 1 在实际网站上填写表格 gt 2 登录 Paypal gt 3 立即付款 PayPal gt 4 数据已插入数据库
  • 使(文本到图像)图像具有一定的宽度但无限的长度?

    我有下面的代码 可以用大量文本生成图像 我希望该图像的宽度为 700 像素 我还希望它保留字符串所具有的段落结构 该字符串来自 MySQL 数据库 我怎样才能实现这一点 font 2 width imagefontwidth font st
  • 使用 file_get_content 发布数据

    我已经做了一些关于如何使用的研究file get content与帖子 我也读过this one https stackoverflow com questions 2445276 how to post data in php using
  • 禁用 WooCommerce 手动/编辑订单的电子邮件通知

    需要 WooCommerce 专业知识 我需要禁用手动创建的订单的电子邮件通知 我必须使用处理状态 由于处理订单状态的自定义挂钩 我无法创建自定义状态 理想情况下 手动订单页面中可以勾选一个复选框 勾选后 它将禁止在每种状态下向客户发送电子
  • 如何将变量插入 PHP 数组?

    我在网上查了一些答案 但都不是很准确 我希望能够做到这一点 id result id info array id Example echo info 0 这有可能吗 您需要的是 不推荐 info array id Example varia

随机推荐

  • CSS3的过渡 transition

    这里只考虑 chrome 的兼容 transition html lt DOCTYPE html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 3
  • CSS3中的3D旋转 rotate、3D位移 translate

    这里只考虑 chrome 的兼容 3DrotateDemo html lt DOCTYPE html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8
  • CSS3让登陆面板旋转起来

    这里只考虑chrome的兼容 LoginRotate html lt DOCTYPE html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 34
  • CSS3 卡片翻转(transform)

    这里只考虑chrome的兼容 card1 html lt DOCTYPE html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 34 gt lt
  • 他们的CSS3 3D正方体

    摘自 xff1a 程旭元 所分享的程序 效果图如下 xff1a cube html lt DOCTYPE html gt lt html lang 61 34 zh CN 34 gt lt head gt lt title gt 3D正方体
  • html自定义复选框

    自定义复选框的素材 xff1a icon check circle png icon checked png checkbox html xff08 为了方便起见 xff0c 这里使用到了jQuery xff09 lt DOCTYPE ht
  • CSS3的基本介绍

    知识点记录 xff1a 1 圆角效果 border radius 如 xff1a border radius 10px 所有角都使用半径为10px 的圆角 border radius 5px 4px 3px 2px 四个半径值分别是左上角
  • CSS3选择器(上)

    1 属性选择器 E att 61 val 选择匹配元素 E xff0c 且 E元素定义了属性 att xff0c 其属性值以 val开头的任何字符串 E att 61 val 选择匹配元素 E xff0c 且 E元素定义了属性 att xf
  • CSS3实现曲线阴影和翘边阴影

    效果图如下 xff1a index html lt DOCTYPE html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 34 gt lt ti
  • THINKPHP 数据操作方法

    一 ThinkPHP Insert 添加数据 ThinkPHP 内置的 add 方法用于向数据表添加数据 xff0c 相当于 SQL 中的 INSERT INTO 行为 添加数据 add 方法是 CURD xff08 Create Upda
  • PHP文件上传的实现及其介绍

    关于实现及介绍在程序注释中 提交文件的页面 xff1a xff08 可以分别提交到doAction php doAction1 php doAction2 php进行测试 xff09 upload php lt doctype html g
  • PHP单文件上传的过程化函数封装

    提交文件的页面 xff1a upload php lt doctype html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 34 gt lt
  • PHP的单个文件上传、多个单文件上传、多文件上传

    单文件上传 upload1 php lt doctype html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 34 gt lt title g
  • PHP实现单文件上传、多个单文件上传、多文件上传的过程化封装

    上回提到 PHP的单个文件上传 多个单文件上传 多文件上传 这里给出 三种方式的统一实现 下面先给出各种方式的文件提交页面 xff1a 单个文件上传 upload1 php lt doctype html gt lt html lang 6
  • PHP的单文件上传类

    提交单文件的页面 upload php lt doctype html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 34 gt lt title
  • PHP的多文件上传类

    提交表单的页面 upload php lt doctype html gt lt html lang 61 34 en 34 gt lt head gt lt meta charset 61 34 UTF 8 34 gt lt title
  • Nginx负载均衡配置实例详解

    转载自 xff1a http www php100 com html program nginx 2013 0905 5525 html 负载均衡是我们大流量网站要做的一个东西 xff0c 下面我来给大家介绍在Nginx服务器上进行负载均衡
  • 基于Bootstrap使用jQuery实现简单可编辑表格

    editTable js 提供编辑表格当前行 添加一行 删除当前行的操作 xff0c 其中可以设置参数 xff0c 如 xff1a operatePos 用于设置放置操作的列 xff0c 从0开始 xff0c 1表示以最后一列作为放置操作的
  • ThinkPHP 大D方法思想下的JDBC操作数据库D类

    这里我封装出来的D 类 xff0c 是根据 ThinkPHP 中的 D 方法中做出来的 xff0c 其中有些出入的地方 xff0c 我进行了一些个性化的修正 xff0c 如 xff1a ThinkPHP 中操作数据库时 xff0c 需要在配
  • 基于MVC设计模式实现简单PHP框架(雏形)-初期

    xff08 记住 xff1a 这里只是提供思考的过程 xff09 其实这里只是一个我们课的Web实验 课程设计题目统计系统 xff0c 在做实验的过程中起初只是想往MVC靠拢而已 xff0c 却不知不觉地 实现 了基于MVC的简单框架的雏形