XML标签语法错误
时间:2011-06-08
来源:互联网
我是新手用2.0版,正在运行论坛中的一步一步循序渐进学习TP,
Lib/Action/IndexAction.class.php
<?php
class IndexAction extends Action{
public function index(){
$array = array();
$array['name'] = "thinkphp";
$array['email'] = "[email protected]";
$array['phone'] = "12335678";
$value = "hello,ThinkPHP";
$this->assign('array',$array);
$this->assign('name',$value);
$this->display();
}
}
?>
Tpl/default/index/index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>{$name}</title>
</head>
<body>
<iterate name="array" id="vo">
{$vo}<br />
</iterate>
</body>
</html>
错误信息如下,请问如何解决?谢谢!
错误位置: FILE: C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\TagLib.class.php LINE: 274
[ 错误信息 ]
XML标签语法错误 : name='array' id='vo'
[ TRACE ]
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\TagLib.class.php (274) throw_exception(XML标签语法错误 : name='array' id='vo')
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\TagLib\TagLibCx.class.php (89) TagLibCx->parseXmlAttr(name='array' id='vo', iterate)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\TagLib\TagLibCx.class.php (120) TagLibCx->_volist(name='array' id='vo', {$vo}
)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\ThinkTemplate.class.php (421) TagLibCx->_iterate(name='array' id='vo', {$vo}
)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\ThinkTemplate.class.php(384) : regexp code (3) ThinkTemplate->parseXmlTag(cx, iterate, name=\'array\' id=\'vo\',
{$vo}
)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\ThinkTemplate.class.php (384) preg_replace(/(.+?)<\/iterate(\s*?)>/eis, $this->parseXmlTag('cx','iterate','\1','\2'),
{$vo}
)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\ThinkTemplate.class.php (260) ThinkTemplate->parseTagLib(cx,
{$vo}
, 1)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\ThinkTemplate.class.php (160) ThinkTemplate->parse(
{$vo}
)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\ThinkTemplate.class.php (135) ThinkTemplate->compiler(
{$vo}
)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Template\ThinkTemplate.class.php (96) ThinkTemplate->loadTemplate(./Myapp/Tpl/default/Index/index.html)
[11-06-08 15:47:06] C:\PHPMysql\www\6\ThinkPHP\Lib\Think\Util\Template\TemplateThink.class.php (45) ThinkTemplate->load(./Myapp/Tpl/default/Index/index.html, Array, utf-8)
[11-06-08 15:47:06] C:\PHPMysql\www\6\Myapp\Runtime\~runtime.php (2) TemplateThink->fetch(./Myapp/Tpl/default/Index/index.html, Array, utf-8)
[11-06-08 15:47:06] C:\PHPMysql\www\6\Myapp\Runtime\~runtime.php (2) View->fetch(, , text/html, 1)
[11-06-08 15:47:06] C:\PHPMysql\www\6\Myapp\Runtime\~runtime.php (2) View->display(, , text/html)
[11-06-08 15:47:06] C:\PHPMysql\www\6\Myapp\Lib\Action\IndexAction.class.php (11) IndexAction->display()
[11-06-08 15:47:06] C:\PHPMysql\www\6\Myapp\Runtime\~runtime.php (2) IndexAction->index()
[11-06-08 15:47:06] C:\PHPMysql\www\6\Myapp\Runtime\~runtime.php (2) call_user_func(Array)
[11-06-08 15:47:06] C:\PHPMysql\www\6\Myapp\Runtime\~runtime.php (2) App::exec()
[11-06-08 15:47:06] C:\PHPMysql\www\6\index.php (13) App::run()
作者: Hadron74 发布时间: 2011-06-08
2.1下没有问题的;
你可以试着将模板中改为{$vo.name}试下
另外不要用这类关键字符来定义变量 ,$this->assign('array',$array);
好的习惯可以避免很多麻烦。
你可以试着将模板中改为{$vo.name}试下
另外不要用这类关键字符来定义变量 ,$this->assign('array',$array);
好的习惯可以避免很多麻烦。
作者: top 发布时间: 2011-06-08
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28