html中的除法计算不起作用

时间:2015-07-27 18:08:56

标签: php html

我正在尝试在html文件中进行除法计算,但它似乎无法使用php或脚本工作。 {{property.listprice}}在我的html文件中正确显示了一个数字,但其他项目不起作用。我不知道如何打电话......这就是我所拥有的。

<?php

$first_number = {{ property.listprice }};
$second_number = 2;
$sum_total = $second_number / $first_number;

print ($sum_total);

?>

该文件以propertyDetails.html结尾,这是插件的一部分,因此无法更改。没有函数{{property.listprice}}可以自行显示。我正在尝试编写一个基本上接受该数字的函数,然后将其除以2 ...

1 个答案:

答案 0 :(得分:0)

有很多可能的原因导致它无法正常工作,我将从基础开始,并将采用典型的解决方案。

  1. 检查文件的扩展名,并确保以&#34; .php&#34;结尾;即使你里面有HTML代码。
  2. 首先尝试&#34;回复$first_number并确保其中包含任何值。
  3. 为什么不使用echo $sum_total代替print功能。