Php 功能不工作
我试图在php论坛脚本的主页上使用带有角度元素的html代码。我正在将这段php代码添加到index.template.php(应该是这样的)中。但它没有显示任何内容Php 功能不工作,php,html,angularjs,Php,Html,Angularjs,我试图在php论坛脚本的主页上使用带有角度元素的html代码。我正在将这段php代码添加到index.template.php(应该是这样的)中。但它没有显示任何内容 <?php /** * Will help you change font and colour on your forum without change templates or making CSS edits. */ function template_colour_picker() { global $
<?php
/**
* Will help you change font and colour on your forum without change templates or making CSS edits.
*/
function template_colour_picker()
{
global $txt;
echo'
<html>'
<div id="colourpicker" ng-app="myApp" ng-controller="ngPicky">
<label>$txt['font']</label>
<input type="text" ng-model="fontName" placeholder="$txt['Enter font name here']">
<label>$txt['color']</label>
<input type="text" ng-model="fontColour" placeholder="$txt['Enter colour name here']">
<label>$txt['background']</label>
<input type="text" ng-model="bgColour" placeholder="$txt'[Enter backgroundcolour name here']">
<hr>
<div class="{{fontName}} {{fontColour}} {{bgColour}}">$txt['Text']</div>
</div>
'</html>';
}
?>
分析错误:语法错误,意外的“ng”(T_字符串),应为“,”或“;”在第405行的…/themes/Silk\u af\u v155/index.template.php中
你有各种各样的错误。请注意单引号(”
)和句点(
)的位置。对照以下内容检查您的:
<?php
function template_colour_picker()
{
global $txt;
echo '
<html>
<div id="colourpicker" ng-app="myApp" ng-controller="ngPicky">
<label>'.$txt['font'].'</label>
<input type="text" ng-model="fontName" placeholder="'.$txt['Enter font name here'].'">
<label>'.$txt['color'].'</label>
<input type="text" ng-model="fontColour" placeholder="'.$txt['Enter colour name here'].'">
<label>'.$txt['background'].'</label>
<input type="text" ng-model="bgColour" placeholder="'.$txt['Enter backgroundcolour name here'].'">
<hr>
<div class="{{fontName}} {{fontColour}} {{bgColour}}">'.$txt['Text'].'</div>
</div>
</html>';
}
到底是什么不起作用(我甚至没有看到你在这段代码中调用函数)什么样的错误?你能告诉我们你得到的信息吗?你的错误信息是什么..?可能是我的PHP有问题。你们发现代码有错误吗?对不起。是角度因素造成了问题。它表示解析错误:语法错误,意外的“ng”(T_字符串),应为“,”或“;”在第405行的…/themes/Silk_af_v155/index.template.php中,你们知道任何可能的修复方法吗?非常感谢@Rasclatt。错误已经消失了。但是页面没有显示html中的任何内容。php是否允许按原样使用?如果您查看源代码,是否有HTML?还有,这些是否真的是数组中的键:“在此处输入颜色名称”
,“在此处输入字体名称”
,等等?遗憾的是,没有。源代码中没有所谓的ngPicky。我认为您需要在上面的代码中添加更多关于如何使用此函数的内容。