S
S
Senseich2017-09-01 16:54:25
css
Senseich, 2017-09-01 16:54:25

How to properly escape a variable that is used in a file path?

I am writing a function that will use the file name, but I don’t know how to escape it correctly, because the variable is seen as text

function massive_csv($file_name){
$arr = file('./$file_name.csv'){

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Proskurin, 2019-05-12
@KRHD

Most conveniently, an after pseudo-element with a gradient. The shadow is not very convenient, because. the sides will stick out a little.

M
Maksim Fedorov, 2017-09-01
@Senseich

  1. replace quotes with double quotes
  2. wrap the variable in curly braces
well, as suggested below
, concatenation -- glue a string and a variable

A
Andrew, 2017-09-01
@Menlod

function massive_csv($file_name){
$arr = file('./' . $file_name . '.csv'){

m?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question