I'm setting up a script for a friend, I want the landing_{random} to be added after the domain names but I whatever I do it shows behind the URL. How can I fix this issue?
I have tried moving the variables around and reversing places with the variables.
<?php
$lines = file('domains.txt');
foreach($lines as $line) {
$randomString = substr(str_shuffle("0123456789abcdef"), 0, 1) .
substr(str_shuffle("0123456789abcdef"), 0, 6);
$landing = "/landing_$randomString";
/*echo "$line.'/landing_'.$randomString";*/
echo "$line{$landing}";
}
?>
I want when I input URL in http://example.com in domains.txt for it to output http://example.com/landing_d2ae5b3
答案 0 :(得分:0)
It will not work like that Try instead:
$landing = '/landing_".$randomString."';
Should work fine now
Update answer
Try this
$landing = "/landing_".$randomString."";
By the way I think you may need to define array before use it like
$lines = explode("" ,$lines);
//then
$landing = "/landing_".$randomString."";
Also you may use this :
echo "$line".$landing."";