我想把一个值在一些javascript代码,像这样:
<?
$page = "test";
echo ('<script id="template-download" type="text/x-jquery-tmpl">
<tr class="template-download{{if error}} ui-state-error{{/if}}">
{{if error}}
<td class="name" style="display: none;">${name}</td>
<td class="size" style="display: none;">${sizef}</td>
.....etc...
{{if thumbnail_url}}
<img src="Img/');
$page;
echo('.jpg">
{{/if}}
.....etc....
</script>');
?>
最终值是这样的:
{{if thumbnail_url}}
<img src="Img/.jpg">
{{/if}}
,它不把值?我错过了什么??
大卫您没有回显页面。
echo $page;
那是因为你使用了单引号所以echo不会对$vars求值就像Joe说的,特别是$page不会被回显