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

请问一下大神,这段 PHP 代码上传 TXT 的格式什么意思啊?

  •  
  •   kkljsj · Dec 23, 2018 · 810 views
    This topic created in 2683 days ago, the information mentioned may be changed or developed.
    $txt = $info['txt']['savename'];
    $content = file_get_contents('Public/Uploads/book/' . $txt);
    $array = explode("###", $content);
    array_shift($array);
    $arr = array();
    foreach ($array as $k => $v) {
    $c = explode("
    ", $v);
    $d = explode($c[0], $v);
    $d[0] = $c[0];
    array_push($arr, $d);
    }
    foreach ($arr as $k2 => & $v2) {
    $v2[1] = str_replace("
    ", "</p><p>", $v2[1]);
    $v2[1] = substr($v2[1], 11);
    $v2[1] = substr($v2[1], 0, strlen($v2[1]) - 10);
    }
    foreach ($arr as $ka => $va) {
    $w2['title2'] = $va[0];
    $w2['content'] = $va[1];
    $w2['number'] = $ka + 1;
    $bi->add($w2);
    }
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1025 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 224ms · UTC 22:10 · PVG 06:10 · LAX 15:10 · JFK 18:10
    ♥ Do have faith in what you're doing.