yaf性能测试(wamp环境)
1实现mvc
出现helloword,成功
2.controller重定向
$get = $this->getRequest()->getQuery("get", "default value"); //2. fetch model
$model = new SampleModel();
$this->forward("login");
//3. assign
$this->getView()->assign("content", $model->selectSample());
$this->getView()->assign("name", $name);
$this->forward("login");
会出现两个index模版和login模版同时加载的情况。
$this->redirect("index/login");
public function indexAction($name = "Stranger") {
//1. fetch query
$get = $this->getRequest()->getQuery("get", "default value"); //2. fetch model
$model = new SampleModel();
$this->redirect("index/login");
//3. assign
$this->getView()->assign("content", $model->selectSample());
$this->getView()->assign("name", $name); //4. render by Yaf, 如果这里返回FALSE, Yaf将不会调用自动视图引擎Render模板
return TRUE;
}
会重定向到http://localhost/yafdemo/index/login成功跳转
3.model模式
在使用自己编写的数据库操作类的时候,没遇到什么问题。
public function _initDatabase()
{
$db_config['hostname'] = $this->arrConfig->db->hostname;
$db_config['username'] = $this->arrConfig->db->username;
$db_config['password'] = $this->arrConfig->db->password;
$db_config['database'] = $this->arrConfig->db->database;
// $db_config['log'] = $this->arrConfig->db->log;
header("Content-type: text/html; charset=utf-8");
Yaf_Registry::set('db', new Db($db_config));
}
4.路由测试
$router = Yaf_Dispatcher::getInstance()->getRouter();
// $route = new Yaf_Route_Rewrite('product/:ident',array('module'=>'User','controller' => 'Index','action' => 'test'));
//使用路由器装载路由协议
//$router->addRoute('product', $route);
$route = new Yaf_Route_Rewrite('cc',array('controller' => 'Index','action' => 'index'));
//使用路由器装载路由协议
$router->addRoute('cc', $route);
路由还有可以在aplication.ini配置的模式,大同小异。
5.引用css,js测试
发现一个问题,就是localhost/public/js/public.js这样的路径居然不可以,但是../public/js/public.js却可以,很神奇。
<html>
<link rel="stylesheet" href="<?=BASICURL?>public/css/common.css" type="text/css">
<script type="text/javascript" src="<?=BASICURL?>public/js/public.js"></script>
<body> <form action="../index/login" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="hidden" value="1" name="submit">
<input type="submit">
</form>
<div>1</div> </body>
</html>
6、表单测试
表单测试没有问题。
<html>
<link rel="stylesheet" href="<?=BASICURL?>public/css/common.css" type="text/css">
<script type="text/javascript" src="<?=BASICURL?>public/js/public.js"></script>
<body> <form action="../index/login" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="hidden" value="1" name="submit">
<input type="submit">
</form>
<div>1</div> </body>
</html>
具体下载地址https://github.com/Wen1750686723/yafdemo
如果想看yaf在wamp上如何安装,请看上篇。
yaf性能测试(wamp环境)的更多相关文章
- 如何搭建一个WAMP环境
最近的一些比赛需要用到PHP,所以急需配置一个PHP的环境,所以分享出来我的经历 一.使用wampserver 这是一个集成软件包,可以一键配置Apache+Mysql+PHP,还具有简单的图形界面 ...
- Windows服务器如何选 搭建WAMP环境
Windows Server 2003 Windows Server 2008 如何选择服务器系统版本.原文地址:http://www.xwamp.com/learn/1. 系统版本: Windows ...
- dede使用方法----如何在wamp环境下安装dede
dede是基本php编写的一套框架,因此在使用dede之前必须要先搭建一上php的环境.本篇文章首先讲述如何搭建一个wamp环境,再讲述如何安装dede. 准备工具:wamp , dedeCMS 1. ...
- windows 环境下wamp环境的搭建。
学php要搭建wamp环境,经常使用的是wampserver,也挺好用的,一键傻瓜式安装,挺省事的.但是程序员都是爱折腾的,总要求要有完美的环境.于是用来用去,觉得还是散装环境最能体现自己的逼格. 其 ...
- wamp环境下外网访问自己电脑自己写的网站
首先我广州电信是对外封杀80端口的,但是内网可以用80端口访问, 可以将访问的端口改成81, apache的配置文件,httpd.conf 首先找到3个Listen 将80端口改成81 #Listen ...
- WAMP环境的安装与测试
首先来点其他的补充:web服务的发展历程 对等网服务模式 没有专门的服务器,也没有专门的客户端!无法提供可靠的服务! C/S模式 client/server,各自安装不同的客户端和服务器端! B/S模 ...
- wamp环境中mysql更改root密码
集成的wamp环境命令不好使,在phpmyadmin中更改密码 权限——root用户修改,执行 然后,你会发现你不能用phpmyadmin登陆了修改下phpmyadmin里面对应的密码就可以了将php ...
- wamp环境下如何安装redis扩展
Redis安装 wamp环境安装redis扩展 首先在自己本地项目中phpinfo(); 查看php版本; (php版本是5.5, ts-vcll表示MSVC11 (Visual C++ 2012), ...
- 搭建Jmeter + Grafana + InfluxDB性能测试监控环境
背景 Jmeter原生的实时监控每半分钟收集一次数据,只能在Linux控制台查看日志输出,界面看起来不直观,图表报告只能等压测结束后才能生成.如下图为jmeter在Linux下运行的实时日志: 那么如 ...
随机推荐
- ITEYE中的读书笔记:重构其实就是持续改进
原文地址:http://hawkon.iteye.com/blog/2093338#bc2355877 前段时间同事参加ITEYE的试读有奖, 没想到得了个奖,拿到一本书.由于同事的推荐我也认真读了一 ...
- C# 中distinct的使用
假设我们有一个类:Product public class Product { public string Id { get; set; } public string Name { get; set ...
- subList和asList
subList subList返回仅仅只是一个视图.直接上源码 public List<E> subList(int fromIndex, int toIndex) { subListRa ...
- StringUtils中 isNotEmpty 和isNotBlank的区别【java字符串判空】
isNotEmpty(str)等价于 str != null && str.length > 0 isNotBlank(str) 等价于 str != null &&am ...
- Log4net源码View之Logger解析
1.简介 Logger是Log4net的三大核心载体之一,搞清楚它的意义很重大.另外两个分别是Appender和Layout.其对应关系为一个Logger对应多个Appender,一个Appender ...
- POJ2047 Concert Hall Scheduling(最小费用最大流)
题目大概是有两个音乐厅,有n个乐队申请音乐厅,他们必须从第ii天到第ji天连续开音乐会且他们的开价是wi,每天每个音乐厅都只能供一个乐队进行音乐会.问接受哪些乐队的申请,获利最多能多少. 这题相当于在 ...
- BZOJ2905 : 背单词
首先对所有单词建立AC自动机,$S$是$T$的子串等价于$T$的某个前缀通过$fail$链可以走到$S$的终止节点,即$S$的终止节点是$T$某个前缀在$fail$树上的祖先. 设$f[i]$表示考虑 ...
- C#创建桌面快捷方式 和 开机启动
/// <summary> /// 创建桌面快捷方式 2010-11-25 /// </summary> p ...
- Winform窗体事件发生顺序
Form 和Control 类公开了一组与应用程序启动和关闭相关联的事件.当Windows 窗体应用程序启动时,主窗体的启动事件按以下顺序引发: System.Windows.Forms.Contro ...
- Javascript Math ceil()、floor()、round()三个函数的区别
Round是四舍五入的...Ceiling是向上取整..float是向下取整. ceil():将小数部分一律向整数部分进位. 如: Math.ceil(12.2)//返回13 Math.ceil(12 ...