Home >Backend Development >PHP Tutorial >折腾1天,js调用php不成功,

折腾1天,js调用php不成功,

WBOY
WBOYOriginal
2016-06-13 11:16:54943browse

折腾1天,js调用php不成功,求助!!!
几个简单的语句
index.html:


<script><br /></script>


test.php:
echo "document.write('你好');";
?>

怎么显示不了‘你好’的结果?网上搜了一天,标点符号问题、php输出js问题等等,还是没成功!显示行1、字符1错误。我的空间是appach+php+mysql,php运行正常。是不是哪个地方参数还需设置?拜求大佬指点迷津。
js?调用?php?失败
------解决方案--------------------
你的 test.php 是 utf-8 编码的吧?
去掉 BOM 头就可以了
------解决方案--------------------
<script><br />document.write('nihao');<br /></script>
------解决方案--------------------
要写那么多干什么
php文件直接写:
echo "document.write('nihao');"; ?>
------解决方案--------------------
引用:
要写那么多干什么
php文件直接写:
echo "document.write('nihao');"; ?>


PHP 里面可以直接这样写吗??

echo "<script>"; ?><br /><br />要这样才可以吧<div class="clear"> </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn