2016-06-10 14 views
0

Ich habe eine PHP-Datei, config.php und es enthält folgenden Code.Wie lese ich PHP-Datei, die Array enthält

Ich möchte diese Datei in eine Variable lesen und dann die Variable wie ein Array lesen. Könnte jemand helfen?

+8

'umfassen (your_file) verwenden können;' als _config variablen Einsatz $ – splash58

+0

Dank viel @Spritzen58 – Atish

Antwort

1

einfach mit PHP, wie es gemeint ist zu arbeiten:

include('config.php'); 
echo $_config['db']['mysolidworks']['host']; 
0

Sie eine der folgenden

<?php 
     $file_loc = 'SomeDir/config.php'; 
     require $file_loc; //Throw a fatal if it's not found 
     require_once $file_loc; //If this might be called somewhere else in your script, only include it once 
     include $file_loc; //Include but just show a warning if not found 
     include_once $file_loc; //Include if not already included and throw warning if not 
    ?> 
Verwandte Themen