Answer the question
In order to leave comments, you need to log in
A valid protocol is not being made in the URI, why?
Good day to all.
There is a list of links, some of them have incorrect protocols (http:/, https:/).
You need to replace it with normal ones (add a second slash).
I upload a file with yurls, go through the array, check and replace, but for some reason it doesn’t work: C
foreach ($get_csv as $url) {
if(!strpos($url[0], '://')){
$url[0]= str_replace(':/', '://', $url[0]);
}
}
Answer the question
In order to leave comments, you need to log in
the standard unloading module is a complete crap, I advise the export module from Acrit.
And I will advise you to create your own upload file, because the standard one, as they wrote above, is crap.
Yours is written in a couple of hours.
1. You cannot check the result of the stripos function for negativity in this way. It can return 0, which will mean that the substring was found on a null character, and you will end up with "unable to find"
2. In fact, you must return $url back to $get_csv in the desired key, i.e. it should be
foreach ($get_csv as $k => $url) {
if(!strpos($url[0], '://')){
$get_csv[$k][0] = str_replace(':/', '://', $url[0]);
}
}
if(!strpos($url[0], '://')){
Warning
This function can return either boolean FALSE or a non-boolean value that casts to FALSE. See Boolean type for more information. Use the === operator to test the value returned by this function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question