smartyquickstart中文

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。http://blog.youkuaiyun.com/mayongzhan - 马永占,myz,mayongzhan

官方的quickstart windows版的是英文的,刚试了下,顺便翻译了一下,并改了点东西,测试能正常运行。
红色字部分是每个人不同的,需要注意。
---------------------------------------------------------------------
Windows下安装 Smarty
前提:服务器和php已经安装好并可以正常运行。
下载 Smarty - http://smarty.php.net
解压文件, 重命名 Smarty.x.x.x 为 smarty (出于方便,建议不要把文件放在服务器目录下)
例如: d:\smarty
运行 phpinfo.php 找到 php.ini 文件的位置
编辑 php.ini的 include_path ,加入smarty的libs的路径。
例如: include_path = ".;d:\smarty\libs"
重启 IIS/Apache
在服务器目录下创建下面两个文件夹:
(wwwroot)/smarty/templates(模板以后放在这里)
(wwwroot)/smarty/configs
在非服务器目录下创建下面两个文件夹:
d:/smarty/templates_c
d:/smarty/cache(这个我目前根据本文的测试,没有用)
设置系统,保证这四个文件是可写的。
在 (wwwroot) 建立 index.php 然后建立 (wwwroot)/smarty/templates/index.tpl ,代码如下:
index.php:
<?php
// load Smarty library
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = ' d:/inetpub/wwwroot/ smarty/templates';
$smarty->config_dir = ' d:/inetpub/wwwroot/ smarty/config';
$smarty->cache_dir = 'd:/smarty/cache';
$smarty->compile_dir = 'd:/smarty/templates_c';
$smarty->assign('name','fish boy!');
$smarty->display('index.tpl');
?>
index.tpl
<html>
<body>
Hello, {$name}!
</body>
</html>
现在在浏览器中打开 index.php
上面是一个简单的例子,下面建立一个使用class的例子:
smarty_connect.php:
<?php
// load Smarty library
require('Smarty.class.php');
class smarty_connect extends Smarty
{
function smarty_connect()
{
// Class Constructor.
// These automatically get set with each new instance.
$this->Smarty();
$this->template_dir = ' d:/inetpub/wwwroot/ smarty/templates';
$this->config_dir = ' d:/inetpub/wwwroot/ smarty/config';
$this->compile_dir = 'd:/smarty/templates_c';
$this->cache_dir = 'd:/smarty/cache';
$this->assign('app_name', 'Intranet');
}
}
?>
index.php:
<?php
require('smarty_connect.php');
$smarty = new smarty_connect;
$smarty->assign('name','Ned');
$smarty->display('index.tpl');
?>
index.tpl:
<html>
<body>
Hello, {$name}!
</body>
</html>
如果出现错误,请察看php.ini文件是否有错误,include是否正确。
注:我自己是把 config templates templates_c 都放到服务器目录下了,而且没有建立 cache 文件夹,程序正常运行。
内容概要:本文档为2013-2014学年第一学期传感器课程的复习题,涵盖了选择题、简答题和分析计算题。选择题部分考察了光电管特性、光纤传感器组成、光敏元件对比、编码器角度计算、传感器功能、测量方法分类、测量电路选择、热电偶材料、光电倍增管特性、测量精度分类、动态特性指标、应变片实验设备、光电导效应、CCD单元、光通量测量特性、红外线气体分析仪工作原理等内容。简答题部分详细解释了传感器的静态和动态特性及其应用条件、自感式传感器的自感变化、光导纤维的导光原理、传感器定义与组成、变极距型电容传感器的工作原理、光纤传感器的工作原理、透射式光栅传感器的莫尔条纹产生机制。分析计算题部分涉及铜电阻的温度特性拟合、电容测微仪的电容变化计算、热电偶的温差电动势计算、电路电阻值计算、测温传感器的时间常数与动态误差分析、应变片电阻变化量计算。 适合人群:正在学习或复习传感器相关知识的学生,尤其是理工科本科生或研究生。 使用场景及目标:①帮助学生巩固传感器的基本概念和原理;②通过具体题目加深对传感器特性和应用场景的理解;③提高学生解决实际问题的能力,如温度、电容、电阻等物理量的测量与计算。 阅读建议:建议读者先熟悉传感器的基础理论知识,再结合题目进行练习,注意理解每个知识点的实际应用背景,并通过计算题提升对公式的掌握程度。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值