这个是学校,所以如果你不想帮助我,我提前警告你。为什么会发布操作将打印代码打印为打印字符串而不是结果? (php)
我有这样的代码在HTML页面中,引用了一个名为dieRoller.php页:
<form method="post" action="dieRoller.php">
<label>Input how many sides your die has:</label>
<input type="numberInput" id="numberInput" name="numberInput" /><br />
<input type="submit" value="submit" name="submit" />
</form>
这是dieRoller.php:
<?php
$numberInput = filter_input(INPUT_POST, "numberInput");
$answerNum = rand(1,numberInput);
print " You've rolled a: " $answerNum;
?>
这可能是地球上最愚蠢的问题地球,但我不明白为什么,当我提交这个表单时,我的结果实际上是一个dieRoller.php文本文件,而不是打印输出?我已经去过。我不明白。
非常感谢您的帮助。
这是在安装了php的服务器上吗? – Musa 2013-03-23 04:23:44
这是在一个测试安装的xampp .... – 2013-03-23 04:25:34
你确定其他PHP文件运行? PHP是否加载了Apache?另外,'numberInput'不是[有效的'input'类型](http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#attr-input-类型)。 – ajp15243 2013-03-23 04:26:05