Encode or somthing to escape slash (/) input in php?

前端 未结 1 837
甜味超标
甜味超标 2021-01-27 23:29

I\'m stack here.

I want to create a file and i use title_input as file_name, but i have problem when create the file to specific folder.

Example:



        
1条回答
  •  心在旅途
    2021-01-27 23:54

    You can always just encode the filename to make a valid filename and then decode the filename after you have read from it and this could be as simple as base64ing the filename before and after.

    $filename = 'Multi purpose Day/Night Security';
    
    // Raw filename
    $filename = base64_encode($filename);
    
    // Original filename
    $filename = base64_decode($filename);
    

    0 讨论(0)
提交回复
热议问题