简体   繁体   中英

Replace space with hyphen in links

I need like this https://play.google.com/store/apps/details?id=com.abc.abcc%26reffer=M1%26name=ABC-DEF-GHI but now it's Coming https://play.google.com/store/apps/details?id=com.abc.abcc%26reffer=M1%26name=ABC DEF GHI

My Code As Follows

https://play.google.com/store/apps/details?id=com.abc.abcc%26reffer=M{{$data['shopID']}}%26name={{$datastr_replace['-','name']}}

Given the following array:

$data = [
  'shop_id' => 'M',
  'name' => 'ABC DEF GHI'
];

You can use the str_replace() method to replace all of your ' ' with - :

<a href="https://play.google.com/store/apps/details?id=com.abc.abcc%26reffer=M{{ $data['shopID'] }}%26name={{ str_replace(' ', '-', $data['name']) }}">Link</a>

You have to change as like str_replace(' ', '-', $data['name']) , may be you have mistaken like name={{$datastr_replace['-','name']}}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM