Home > Mobile >  how to rename folder in PHP The system cannot find the file specified. (code: 2)
how to rename folder in PHP The system cannot find the file specified. (code: 2)

Time:03-03

If I change the site name, I want the folder name to change, how can I do that? i think this is changing the filename

$OldNameFolder=$path.$OldName;
$NewNameFolder=$path.$NewName;
rename('$OldNameFolder','$NewNameFolder');

CodePudding user response:

Don't enclose a variable as PHP will just think it's a string... So next time you should check if it's a variable before putting it in quotes :)

CodePudding user response:

Try remove variables in string

rename($OldNameFolder,$NewNameFolder);
  •  Tags:  
  • php
  • Related