我正在我的服务器上尝试这个新脚本,但我似乎无法弄清楚为什么它一直给我以下错误:
警告:file_get_contents():第 51 行 /includes/classes/spin_article.php 中的文件名不能为空
这一行给出了错误 --> $string = file_get_contents($files[rand(1, count($files)) -1]);
<?PHP
class Spintax
{
public function process($text)
{
return preg_replace_callback(
'/\{(((?>[^\{\}]+)|(?R))*)\}/x',
array($this, 'replace'),
$text
);
}
public function replace($text)
{
$text = $this->process($text[1]);
$parts = explode('|', $text);
return $parts[array_rand($parts)];
}
}
?>
<?PHP
ob_start();
$files = glob("spintax_articles/*.txt");
$spintax = new Spintax();
$string = file_get_contents($files[rand(1, count($files)) -1]);
echo $spintax->process($string);
$page = ob_get_contents();
ob_end_flush();
$fp = fopen("content.txt","w");
fwrite($fp,$page);
fclose($fp);
?>