2016-10-15 2 views
1

Angenommen, ich habe ein Projekt Inventar, geschrieben von CodeIgniter. Das Problem, das ich konfrontiert ist:Wie base_url() Problem in CodeIgniter 3.1.0 zu beheben?

In CodeIgniter 3.1.0 der Wert Rückkehr von <?php echo base_url(); ?> ist http://[::1]/inventory/

aber ältere Version von CodeIgniter (das heißt: 3.0.1) gibt den vollständigen Basispfad (das heißt: http://localhost/inventory).

Nun mag ich den vollen Basispfad 3.1.0 [d.h :: http://localhost/inventory statt http://[::1]/inventory/]

jemand mit base_url() in CodeIgniter zurückkehren kann mir sagen, wie kann ich tun, dass in CodeIgniter 3.1.0?

+2

haben Sie in '$ config ['base_url'] = ''; in der Konfigurationsdatei geändert? –

+0

Was ist dein Problem? [:: 1] und localhost sind im Grunde dasselbe. –

+0

@SayantanDas :: http: // localhost ist wichtiger als [:: 1] für mich (vielleicht für andere), deshalb möchte ich es ändern. – Shimul

Antwort

1

Bitte überprüfen Sie Ihre Basis-URL in application/config/config.php

Wechsel von

$config['base_url'] = 'something'; 

zu

$config['base_url'] = (isset($_SERVER['HTTPS']) ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . preg_replace('@/[email protected]', '', dirname($_SERVER['SCRIPT_NAME'])) . '/'; 

$config['base_path'] = $_SERVER['DOCUMENT_ROOT'] . preg_replace('@/[email protected]', '', dirname($_SERVER['SCRIPT_NAME'])) . '/'; 

Es ist nicht nötig, nach dem Platzieren etwas zu ändern. Verwenden Sie einen lokalen oder einen aktiven Host.

1

öffnen Sie application/config Verzeichnis, in dem Sie config.php Datei finden. Jetzt $config['base_url'] = ''; Änderung dies wie folgt

$config['base_url'] = 'http://localhost/inventory/'; 

Dies ist obligatorisch in Codeigniter 3.1.0

Verwandte Themen