日期:2014-05-17  浏览次数:20607 次

php的io操作
C# code

 public static void WriteLog(string msg) {
            using (System.IO.StreamWriter reader = new System.IO.StreamWriter(System.Web.HttpContext.Current.Server.MapPath("~/log.txt"), true, Encoding.UTF8)) {
                reader.WriteLine(msg + "\t" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            }
        }

 



我绝望了 不设断点了 写在记事本算了 

php的io不熟 那位大侠把这个转成等效的php代码啊

------解决方案--------------------
file_put_contents( realpath('~/log.txt'), $msg . date('Y-m-d H:i:s));

------解决方案--------------------

代码很简洁啊
------解决方案--------------------
探讨

file_put_contents( realpath('~/log.txt'), $msg . date('Y-m-d H:i:s));

------解决方案--------------------
探讨
文件不存在不会自动创建?