小编Joh*_*ith的帖子

用 PHP 编写一个新文件并附加一个文件而不删除内容

如何在不删除文件的所有其他内容的情况下在 php 中向文件中写入新行?

<?php
if(isset($_POST['songName'])){

        $newLine = "\n";
        $songName = $_POST['songName'];
        $filename = fopen('song_name.txt', "wb");
        fwrite($filename, $songName.$newLine);
        fclose($filename);
    };

?>
Run Code Online (Sandbox Code Playgroud)

这是文件的样子 当前视图

这就是理想视图的样子

php fwrite

4
推荐指数
1
解决办法
4029
查看次数

为什么通过php发送的电子邮件中的文本被置于新行?

我正在为我网站的客户编写电子邮件脚本以确认订单.我遇到一个问题,即电子邮件中显示的订单总数放在新行上,但代码中没有新行.我附上了正在发生的事情的图像.在此输入图像描述

这是我的代码:

<?php
  if(isset($_POST['email']) && isset($_POST['name']) && isset($_POST['order'])) {
    $to = $_POST['email'];
    $name = $_POST['name'] .",";
    $order = $_POST['order'];
    $trackingNumber = $_POST['trackingNumber'];
    $totalAmount = "Your total was: $".$_POST['totalAmount'];

    if(!empty($to) && !empty($name) && !empty($order)) {

      $subject = 'From the band.it team ';
      $text = "My name is Bobby and I am a part of band.it's fulfillment Team! We recieved your order and are working to process it from our Gainesville, Florida facility. Feel free to reach out to us at any …
Run Code Online (Sandbox Code Playgroud)

php email phpmailer

2
推荐指数
1
解决办法
41
查看次数

标签 统计

php ×2

email ×1

fwrite ×1

phpmailer ×1