log.php
define ( 'COMPANY_WEB', 'www.6666.com' );
//define ( 'COMPANY_WEB', 'www.6666.com' );
define ( 'COMPANY_FAX', 'asdfffff' );
私の文字列置換コード...
$config_old_arr[0] = " define ( 'COMPANY_WEB', 'www.6666.com' )";
$config_new_arr[0] = " define ( 'COMPANY_WEB', 'www.NEW.com' )";
$config_new_file_content = str_replace($config_old_arr, $config_new_arr, $logfilecontent);
コードを実行した後...新しいlog.phpファイルを変更します
logNew.php
define ( 'COMPANY_WEB', 'www.NEW.com' );
//define ( 'COMPANY_WEB', 'www.NEW.com' );
define ( 'COMPANY_FAX', 'asdfffff' );
ただし、コメントなしの行(1行目)の値のみを変更したいので、結果の文字列は次のようになります
logNew.php
define ( 'COMPANY_WEB', 'www.NEW.com' );
//define ( 'COMPANY_WEB', 'www.6666.com' );
define ( 'COMPANY_FAX', 'asdfffff' );
i like to use str_replace() function but that method may be not suitable for this problem Anyone know solution for this problem please help to me.