这篇文章主要介绍了php去除换行(回车换行)的三种方法,需要的朋友可以参考下
复制代码 代码如下:
//php 不同系统的换行
//不同系统之间换行的实现是不一样的
//linux 与unix中用 \n
//MAC 用 \r
//window 为了体现与linux不同 则是 \r\n
//所以在不同平台上 实现方法就不一样
//php 有三种方法来解决
//1、使用str_replace 来替换换行
$str = str_replace(array("\r\n", "\r", "\n"), "", $str);
//2、使用正则替换
$str = preg_replace('//s*/', '', $str);
//3、使用php定义好的变量 (建议使用)
$str = str_replace(PHP_EOL, '', $str);
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools
