zoukankan      html  css  js  c++  java
  • php去除换行(回车换行)的方法

    php去除换行(回车换行)的三种方法。

    代码: 

    <?php   
     //php 不同系统的换行  
    //不同系统之间换行的实现是不一样的  
    //linux 与unix中用    
    //MAC 用    
    //window 为了体现与linux不同 则是    
    //所以在不同平台上 实现方法就不一样  
    //php 有三种方法来解决  
    // www.jbxue.com
    //1、使用str_replace 来替换换行  

    $str = str_replace(array(" ", " ", " "), "", $str);   

    //2、使用正则替换  
    $str = preg_replace('//s*/', '', $str);  

    //3、使用php定义好的变量 (建议使用)  
    $str = str_replace(PHP_EOL, '', $str);   
    ?>  
  • 相关阅读:
    深拷贝与浅拷贝
    图片旋转插件
    promise 小抄
    github fork项目更改后与原作者同步更新
    eslint 的配置
    css规范
    Object类
    BigIntager
    System类
    Math类和Random类
  • 原文地址:https://www.cnblogs.com/linuxnotes/p/3627460.html
Copyright © 2011-2022 走看看