I have a text file named Se7enPlug.dspl. In this file I have only one line of text, formatted like this:
text1,text2,text3
I need to read this file and return something like this:
public function rconGetNextMap() {
$myFile = "E:\mw3-server\admin\Se7enPlug.dspl";
$fh = fopen($myFile, 'r');
$theData = fread($text1,$text2,$text3);
fclose($fh);
echo $theData;
if ($theData) {
$next = array("map" => $text1, "gametype" => $text2, 0=>$text1, 1=>$text2);
}
elseif (!$theData)) {
$next = array("map" => "Unknown", "gametype" => "Unknown", 0=>"Unknown",1=>"Unknown");
}
return $next;
}
As you see its has many problems. How can I fix it?
This will read in your text file and save the first and second values into the array