2014-07-05 34 views
5

Ben düzenledim ama arama anahtar kelimelerim işe yaramıyor, bu yüzden denetleyicide URL protokolünü nasıl alabilirim? IS http: // veya https: //Denetleyicideki URL'den protokol alma

http://whatever.com/app_dev.php/welcome 

//I need to echo http:// protocol here 
echo $request->getHost(); //echos whatever.com 
echo $request->getBaseUrl(); //echos app_dev.php/ 

cevap

4

istek https kullanımı olup olmadığını kontrol etmek için: daha fazla bilgi için

$request->isSecure() 

Kontrol doc

+0

Teşekkür ... foreach' döngü' yukarıda – BentCoder

6

Sen denetleyicisi bu kullanabilirsiniz:

$scheme = $this->getRequest()->getScheme(); 

Aksi takdirde, burada tüm bilmeniz gereken bir kod var. `; Işe yaradı

foreach ($_SERVER as $key => $value) { 
     echo $key.' => '.$value.'<br>'; 
    } 
+1

print_r ($ _ SERVER) 'küçültülmüş olabilir: Değerler, sunucu tarafından döndürülen –

İlgili konular