-1

I am trying to combine some php variables to get the full path to a file.

$filepath and $file are working variables. I want the combined variable to be like > filepath/file.xml

$get = file_get_contents( $filepath '/' $file '.xml');

this is what I have and does not work.

jasenmichael
  • 388
  • 5
  • 17

3 Answers3

1

Add concatenate of both $filepath and $file

$get = file_get_contents( $filepath.'/'.$file.'.xml');
Suneel Kumar
  • 1,650
  • 2
  • 21
  • 31
0

Use this code:

You are missing . for concatenate.

$get = file_get_contents( $filepath.'/'.$file.'.xml');
Chandra Kumar
  • 4,127
  • 1
  • 17
  • 25
0

if you want to combine the path, don't forget using predefined constants DIRECTORY_SEPARATOR (slash or back slash according with your system) and concatenate it with "."

$DS = DIRECTORY_SEPARATOR;  
$get = file_get_contents( $filepath.$DS.$file.'.xml');
Ayirp86
  • 31
  • 3