Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
goodday001
V2EX  ›  Linux

如何用 Linux 命令批量在某文件下某行代码下添加 PHP 代码

  •  
  •   goodday001 · Dec 10, 2018 · 1546 views
    This topic created in 2803 days ago, the information mentioned may be changed or developed.

    有 10 来个一样的站 /data/www/aa.com/test.php; /data/www/bb.com/test.php; /data/www/cc.com/test.php;

    想用 Linux 命令批量修改 /data/www/aa.com/test.php 某文件 某行下 $M=$this->MODEL('article'); 添加如下代码

    		$M->AddNewsHits(array("id"=>(int)$_GET['id']));
    		$news_info=$M->GetNewsBaseOnce(array("id"=>(int)$_GET['id']),array("field"=>"hits"));
    		echo "document.write('".$news_info["hits"]."')";
    

    用 linux shell 命令如何写呢

    1 replies    2018-12-14 13:51:45 +08:00
    seakingii
        1
    seakingii  
       Dec 14, 2018
    shell 脚本不会写.不过你可以用 php 或者 python 写脚本来干这个事啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3133 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 13:57 · PVG 21:57 · LAX 06:57 · JFK 09:57
    ♥ Do have faith in what you're doing.