代码之家  ›  专栏  ›  技术社区  ›  The.Anti.9

PHP返回部分代码文档

php
  •  0
  • The.Anti.9  · 技术社区  · 15 年前

    我有一个PHP页面,它根据需要做一些不同的事情 action

    ...
    } elseif ($_GET['action'] == 'addtop') {
        if (!isset($_GET['pname']) || !isset($_GET['url']) || !isset($_GET['artist']) || !isset($_GET['album']) || !isset($_GET['file'])) {
            die('Error: Incomplete data!');
        }
        if (!file_exists($_GET['pname'].".txt")) {
            die('Error: No such playlist!');
        }
        $plist = json_decode(file_get_contents($_GET['pname'].".txt"), true);
        $fh = fopen($_GET['pname'].".txt", 'w') or die('Could not open playlist!');
        array_push($plist, array("artist" => $_GET['artist'], "album" => $_GET['album'], "file" => $_GET['file'], "url" => $_GET['url']));
        fwrite($fh,json_encode($plist));
    } elseif ($_GET['action'] == 'delfromp') {
    ...
    

    下面是我在浏览网页时得到的信息:

    $\u GET['url']); fwrite($fh,json_encode($plist));} {如果(!isset($\u GET['pname'])|| 数据不完整!');}如果 (!文件存在($\u GET['pname']。“.txt”)) {die('错误:没有这样的播放列表!');} 正确)$fh公司= fopen($\u GET['pname']。“.txt”,'w')或 死('无法打开播放列表!'); 未设置($plist[$\u GET['id']])$普利斯特= 数组值($plist); fwrite($fh,json_encode($plist));} elseif($\u GET['action']=='readp'){ 如果 (!文件存在($\u GET['pname']。“.txt”)) {die('错误:没有这样的播放列表!');} $plist公司= 正确)$arr=数组(“条目”=> $plist)$json=json_encode($arr); echo$json;}elseif($\u GET['action'] =='getps'){$plists=array();if($handle=opendir('Playlists')){ while(假!==($播放列表= “.”和&$播放列表!=“.”){ 0,strripos($playlist,'.')-1));}} else{die('错误:无法打开 播放列表!');}$阿里尔= json\u编码($arr);echo$json;}其他的 {die('错误:没有这样的操作!');}&燃气轮机;

    它从中间开始。 array_push(... 线路。

    我真的想不出它在干什么。没有 echo

    1 回复  |  直到 15 年前
        1
  •  3
  •   St. John Johnson    15 年前

    看起来像 => 正在关闭PHP代码。是否启用了短标记?或者某种定制标签?

    推荐文章