V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
p1956
V2EX  ›  问与答

PHP 运行 shell 命令问题

  •  
  •   p1956 · Oct 3, 2024 · 1542 views
    This topic created in 578 days ago, the information mentioned may be changed or developed.
    $command = 'ffprobe -i "/www/wwwroot/中島美嘉 - Wish (バズリズム02 2022.11.12).ts" ' ;
    echo shell_exec($command);

    如果出现日文或中文或韩文,不会有任何输出,英文正常,这是为什么,chatgpt 给的回答都不行
    这个 shell 命令在终端运行正常
    Supplement 1  ·  Oct 3, 2024
    $command = 'wc -c "/www/wwwroot/中島美嘉 - Wish (バズリズム02 2022.11.12).ts" ' ;
    echo shell_exec($command);

    $command = echo "/www/wwwroot/中島美嘉 - Wish (バズリズム02 2022.11.12).ts" ' ;
    echo shell_exec($command);

    这两个都可以正常运行
    sagaxu
        1
    sagaxu  
       Oct 3, 2024
    PHP 编码问题,先确认源码文件是不是 UTF-8(without BOM)编码
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1069 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:57 · PVG 07:57 · LAX 16:57 · JFK 19:57
    ♥ Do have faith in what you're doing.