SA-MP Forums Archive
php read config file help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: php read config file help (/showthread.php?tid=71946)



php read config file help - StrickenKid - 04.04.2009

EDIT: i figured it out already!
this is a php question:

hers my problem, SAMP uses spaces in-between the varname and the vars so when im using php to explode the var, it only shows the first var.

heres the code:

Код:
$fp = fopen($config_file, "r");

	while (!feof($fp))
	{
		$line = trim(fgets($fp));
		$pieces = explode(" ", $line);
		$option = trim($pieces[0]);
		
		$value = trim($pieces[1]);
		
		$config_values[$option] = $value;
	}
	
	fclose($fp);
and this explains more of the problem
Код:
hostname Cops And Robbes
0    1  2 3
i can only define to explode 1 OR 2 OR 3, how can i do them all except for 0?

thanks for any help!


Re: php read config file help - StrickenKid - 05.04.2009

anyone know php


EDIT: Got It! No Need To Let Me Know~!!