是否可以在php文件中添加“dsafe_mode = Off”?

I'm running a script that needs dsafe_mode=Off.

I can run this script in terminal using php -dsafe_mode=Off /usr/src.

But I want to run it over the web, Is it possible to add dsafe_mode=Off inside the code ?

Something like:

<?php -dsafe_mode=Off
....SCRIPT.....
?>

No.

That would moot the whole reason of why safe_mode was introduced in the first place. safe_mode has also been removed from PHP 5.4. You'll have to change it in php.ini or from the context when the script is executed.

No, you can't do this.

safe_mode's changeable level is PHP_INI_SYSTEM, which means you could change this setting only in php.ini or httpd.conf.