2016-07-22 136 views
-2

它說,那裏有一個錯誤如何解決這個PHP代碼

我試圖讓它之間搶playlist.m3u8?wmsAuthSign =上什麼都頁我以後myLink的投入。 COM/file.php?F =任何任何然後將在使用getURL代碼,以便它playlist.m3u8?wmsAuthSign =上抓起之間放置www.linkhere.com/linkhere.com/whatever頁面(如果是有道理的

下面是代碼:

<?php 
    function getURL($u){ 
     $u = file_get_contents("http://{$u}"); 
     return $u != false ? $u : ""; 
    } 
    function GetStringBetween($string, $start, $finish){ 
     $string = " ".$string; 
     $position = strpos($string, $start); 
     if ($position == 0) return ""; 
     $position += strlen($start); 
     $length = strpos($string, $finish, $position) - $position; 
     return substr($string, $position, $length); 
    } 
    $stream = GetStringBetween(getURL("www.linkhere.com/<?=!isset($_GET["f"]) ? "filehere.php" : htmlspecialchars($_GET["f"])?>"),"playlist.m3u8?wmsAuthSign=", '"'); 
?> 
+1

*「它說,那裏有一個錯誤」 *,有什麼錯誤? –

+0

第22行中的/home/ygwtljbj/public_html/fs2.php中的語法錯誤,意外的'「',預計標識符(T_STRING)或變量(T_VARIABLE)或編號(T_NUM_STRING),第22行是$ stream行 –

+0

您提供的代碼示例中甚至沒有22行代碼,所以錯誤可能來自其他內容,或者您​​沒有向我們顯示實際代碼。 – duskwuff

回答

0
$url = (!isset($_GET["f"])) ? "filehere.php" : htmlspecialchars($_GET["f"]); 
$stream = GetStringBetween(getURL("www.linkhere.com/".$url),"playlist.m3u8?wmsAuthSign=", '"'); 
+0

解析錯誤:語法錯誤,意外的'「),」'(T_CONSTANT_ENCAPSED_STRING)在/home/ygwtljbj/public_html/fs2.php在第24行這是$流 –

+0

請編輯更多的信息。僅限代碼和「嘗試這個」的答案是不鼓勵的,因爲它們不包含可搜索的內容,也不解釋爲什麼有人應該「嘗試這個」。 – abarisone

1
<?php 
    function getURL($u){ 
     $u = file_get_contents("http://{$u}"); 
     return $u != false ? $u : ""; 
    } 
    function GetStringBetween($string, $start, $finish){ 
     $string = " ".$string; 
     $position = strpos($string, $start); 
     if ($position == 0) return ""; 
     $position += strlen($start); 
     $length = strpos($string, $finish, $position) - $position; 
     return substr($string, $position, $length); 
    } 


$url = (!isset($_GET["f"])) ? "filehere.php" : htmlspecialchars($_GET["f"]); 
$stream = GetStringBetween(getURL("www.linkhere.com/".$url),"playlist.m3u8?wmsAuthSign=", '"'); 
?> 

所以這樣嗎?

+0

這應該是.... – Poiz

0

難道你不認爲在步驟&之前打破你的代碼是很有意義的,直到你可以在睡覺時進行編程嗎?此外,將代碼分解成步驟可幫助您更清楚地瞭解並學習。隨着一個人的進步,人們發現自己甚至在一條線上寫了一個複雜的算法(這對於學徒來說需要30行)......但是在那之前......建議學徒從構建塊開始,然後建立並即使做了複雜的方式(只要簡單的,長的,無聊的辦法已經制定,併產生很大的啓示)....

<?php 
     function getURL($u){ 
      $u  = file_get_contents("http://{$u}"); 
      return ($u != false) ? $u : ""; 
     } 

     function GetStringBetween($string, $start, $finish){ 
      $string  = " ".$string; 
      $position = strpos($string, $start); 

      if ($position == 0){ return "";} 

      $position += strlen($start); 
      $length  = strpos($string, $finish, $position) - $position; 

      return substr($string, $position, $length); 
     } 

     $f  = (!isset($_GET["f"])) ? "filehere.php" : htmlspecialchars(trim($_GET["f"]); 
     $url  = "www.linkhere.com/{$f}"; 
     $theURI = getURL($url); 

     $stream = GetStringBetween($theURI,'playlist.m3u8?wmsAuthSign=', '\"'); 
    ?>