Skip to content

Instantly share code, notes, and snippets.

@sineld
Created October 3, 2012 07:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sineld/3825572 to your computer and use it in GitHub Desktop.
Save sineld/3825572 to your computer and use it in GitHub Desktop.
Php ile dosya içeriği okuma - Read file contents with php
// Source URL: http://forum.ceviz.net/php/121070-veritabani-bilgileri-include-etmek.html#post711169
File to read (readme.php) contents:
; <?php exit; ?> DO NOT DELETE THIS LINE
dbhost="localhost"
dbport="3306"
dbuser="root"
dbpass=""
dbname="webtrees"
tblpfx="wt_"
<?php
$satirlar = file('readme.php');
foreach ($satirlar as $satir)
{
preg_match_all('#\"(.*?)\"#', $satir , $eslesen);
for ($i=0; $i< sizeof($eslesen[1]);$i++)
$dizi[] = $eslesen[1][$i];
}
echo $localhost = $dizi[0];
echo $dbport = $dizi[1];
echo $dbusername = $dizi[2];
echo $dbpassword = $dizi[3];
echo $dbname = $dizi[4];
echo $dbprefix = $dizi[5];
unset($dizi);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment