PHP字符串替换为"&&引用;

PHP字符串替换为"&&引用;,php,string,replace,Php,String,Replace,我目前正在图片上传过程中用下划线替换空格。 我怎样才能把它也包括进去,使它变为“和” 有点被这一个卡住了,甚至不知道该尝试什么..$newname=str_replace(数组(“,”&'),数组(“,”,”),)我想你的意思是相反的。将空格替换为下划线,而不是“&”。另外,将“&”替换为“and”。@cillosis上面用下划线替换空格,用“and”替换(&D)。 $newname = str_replace( ' ', '_', trim( strip_tags( $_POST['name'

我目前正在图片上传过程中用下划线替换空格。 我怎样才能把它也包括进去,使它变为“和”


有点被这一个卡住了,甚至不知道该尝试什么..

$newname=str_replace(数组(“,”&'),数组(“,”,”),)

我想你的意思是相反的。将空格替换为下划线,而不是“&”。另外,将“&”替换为“and”。@cillosis上面用下划线替换空格,用“and”替换(&D)。
$newname = str_replace( ' ', '_', trim( strip_tags( $_POST['name'] ) ) ) . _ . $formKey->generateKey() . '_' . time() . '.jpg';