Home > other >  Handle a space inside a php query in PHP
Handle a space inside a php query in PHP

Time:12-07

I'm using a file get contents to show the last news of a page. Some of my page titles have more than one word. How can i work with this spaces between the words. Title works. Second title isn't working at the moment. Thanks for your support.

<?php echo file_get_contents('https://www.example.com/archiv?s='.$t['page.content_title'].''); ?>

CodePudding user response:

use this:

<?php 
echo file_get_contents('https://www.example.com/archiv?s='. urlencode($t['page.content_title'])); 
?>
  •  Tags:  
  • php
  • Related