2017-06-23 10 views
0

ちょっと、このコードのWhitesapceを削除する方法はありますか?
このPHPコードの空白を削除するにはどうしたらいいですか?

<script async defer src="https://maps.googleapis.com/maps/api/js?v=3&key=<?JComponentHelper::getParams('com_ohanah')->get('maps_api_key_js')?>"></script> 

、作成URLがあなたが=と検閲の間の間隔であることがわかり

https://maps.googleapis.com/maps/api/js?v=3&key= CENSORED 

です... 私はそれを削除する必要があります:/

+3

を' – AbraCadaver

+0

何/テキストはエコー/プリントされますか? – Terminus

答えて

0

ここにtrimを使用することをお勧めします。この意志安全なトラブルあなたは右と左サイドのいくつかの奇妙な文字を取得する場合:<??(JComponentHelperを.............)トリム> `

<script async defer src="https://maps.googleapis.com/maps/api/js?v=3&key=<?trim(JComponentHelper::getParams('com_ohanah')->get('maps_api_key_js'))?>"></script> 
0

あなたは適用することができます次のstr_replace()はあなたのURLに機能します

$url = "https://maps.googleapis.com/maps/api/js?v=3&key= CENSORED"; 
$cleanUrl = str_replace(" ", "", $url); 

cleanUrlはそれを行うための最も安全な方法はLTRIMを使用することです

"https://maps.googleapis.com/maps/api/js?v=3&key=CENSORED" 
0

をoutpuます:

<script async defer src="https://maps.googleapis.com/maps/api/js?v=3&key=<?ltrim(JComponentHelper::getParams('com_ohanah')->get('maps_api_key_js'))?>"></script> 

はそれが役に立てば幸い!

関連する問題