php 5.3 CLI垃圾字符 [英] php 5.3 CLI junk characters

查看:132
本文介绍了php 5.3 CLI垃圾字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题,每当我从命令行运行一个简单的php脚本,它显示一些垃圾字符之前。



我使用php 5.3。

 <$> 

c $ c><?php
echoHi;出口;
?>

这里是我在cli中获得的

 Hi



感谢

解决方案

这是UTF-8 BOM。在您的编辑器中,将文件另存为没有BOM的UTF-8(查找该设置,它必须在某处,如果您找不到它,请更改您的编辑器)。


I am facing problem like whenever I run a simple php script from the command line, it is showing some junk character before it.

I am using php 5.3.9 on wamp server on windows 7.

Here is my code of my script

<?php
echo "Hi"; exit;
?>

and here is what i get in cli

Hi

Let me know if anyone else has faced same like problem and know the solution.

Thanks

解决方案

This is the UTF-8 BOM. In your editor, save the file as 'UTF-8 without BOM' (look for that setting, it must be there somewhere. If you can't find it, change your editor).

这篇关于php 5.3 CLI垃圾字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆