如何解决这个PHP代码
它说,那里有一个错误如何解决这个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=", '"');
?>
$url = (!isset($_GET["f"])) ? "filehere.php" : htmlspecialchars($_GET["f"]);
$stream = GetStringBetween(getURL("www.linkhere.com/".$url),"playlist.m3u8?wmsAuthSign=", '"');
解析错误:语法错误,意外的'“),”'(T_CONSTANT_ENCAPSED_STRING)在/home/ygwtljbj/public_html/fs2.php在第24行这是$流 –
请编辑更多的信息。仅限代码和“尝试这个”的答案是不鼓励的,因为它们不包含可搜索的内容,也不解释为什么有人应该“尝试这个”。 – abarisone
<?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=", '"');
?>
所以这样吗?
这应该是.... – Poiz
难道你不认为在步骤&之前打破你的代码是很有意义的,直到你可以在睡觉时进行编程吗?此外,将代码分解成步骤可帮助您更清楚地了解并学习。随着一个人的进步,人们发现自己甚至在一条线上写了一个复杂的算法(这对于学徒来说需要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=', '\"');
?>
*“它说,那里有一个错误” *,有什么错误? –
第22行中的/home/ygwtljbj/public_html/fs2.php中的语法错误,意外的'“',预计标识符(T_STRING)或变量(T_VARIABLE)或编号(T_NUM_STRING),第22行是$ stream行 –
您提供的代码示例中甚至没有22行代码,所以错误可能来自其他内容,或者您没有向我们显示实际代码。 – duskwuff