PHP文件没有显示任何内容?

时间:2015-10-27 04:12:13

标签: php

我有当前的代码,只有在我注释掉该功能时它才有效。救命? 它没有显示标题标签或任何东西。我认为它缺少一些语法,但还没有看到它。

<html>
<head>
<title>Convert to Roman</title>
</head>
<body>
<?php
function integerToRoman($integer)
{
 // Convert the integer into an integer (just to make sure)
 $integer = intval($integer);
 $result = '';

 // Create a lookup array that contains all of the Roman numerals.
 $lookup = array('M' => 1000,
 'CM' => 900,
 'D' => 500,
 'CD' => 400,
 'C' => 100,
 'XC' => 90,
 'L' => 50,
 'XL' => 40,
 'X' => 10,
 'IX' => 9,
 'V' => 5,
 'IV' => 4,
 'I' => 1);

 foreach($lookup as $roman => $value){
  // Determine the number of matches
  $matches = intval($integer/$value);

  // Add the same number of characters to the string
  $result .= str_repeat($roman,$matches);

  // Set the integer to be the remainder of the integer and the value
  $integer = $integer % $value;
 }

 // The Roman numeral should be built, return it
 return $result;
}
echo integerToRoman(5);
?>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

要使其正常工作,您应该在php.ini中更改以下变量:

$ which php

搜索它们,因为它们已经定义并添加了您想要的值。然后重启你的apache2服务器,一切都会正常工作。祝你好运!

PHP errors NOT being displayed in the browser [Ubuntu 10.10]

同时检查是否安装了PHP 尝试

using(Form f = new Form1())
{
     f.ShowDialog(this);// while the 'this' is the parent form calling
}