0
I have that code:
if(count($vid_files)>0){
$videoNames = array_keys($vid_files);
$videoName = basename($videoNames[0]);
$this->videourl = $videoName;
I would like to add a url at the beginning after the result of basename, the result of it is 100392video.mp4 I wanted the url to be in front, example.
$this->videourl = "url" + $videoName;
Only when I do that, the numbers come out.
100392
And no url comes out or the ending that is .mp4.
In answer to Isac;
public function add($f3, $id, $name, $userid, $category, $vid_files){
//add or edit to db
if($id>=0){
$this->load(array('id = ?',$id));
}
$this->userid = $userid;
$this->name = $name;
$this->category = $category;
if(count($vid_files)>0){
$videoNames = array_keys($vid_files);
$videoName = basename($videoNames[0]);
$this->videourl = $videoName;
}
$this->save();
}
var_dump($vid_files);
before theif
presents what?– Isac
My question was in the sense of realizing what exactly has its variable
$vid_files
that just by asking the question you can’t understand. Still in the answer (which should be an edition of the question) I do not think I put in the correct place. The idea is to put exactly before use, which would be beforeif(count($vid_files)>0){
and show us what comes out as a result of that dump– Isac
@Isac would be that?
– user81560
Not so much, because it is not yet clear what
$vid_files
has. Placevar_dump($vid_files);
on the line just beforeif(count($vid_files)>0){
. Then test again and put in question the result that thevar_dump
gave.– Isac
@Isac I can’t see what’s in vid_files.
– user81560
@Isac has some idea?
– user81560
basename
will fetch the final part of the path, which will be the name of the file. However if you cannot find out what you are searching for in$vid_files[0]
becomes impossible to help. Just trying to guess. By making a small analogy, it’s like trying to get a mechanic to fix your car without opening the hood, just for the sound of it. The only way he’s gonna get his car fixed is if he’s lucky enough to guess the problem from the sound.– Isac
@Isac da to join "URL" + $videoNames[0] ?
– user81560
Gives, but concatenate in php is with
.
and not+
, assuming we’re talking strings– Isac
@Our Isac, sorry! was just that, I forgot that to concatenate with php was with
.
kkkk, obg Isac :)– user81560