mirror of
https://github.com/myvesta/vesta
synced 2025-07-05 20:41:53 -07:00
Update string.php
This commit is contained in:
parent
98cc47e654
commit
ea0fa49d0e
1 changed files with 2 additions and 2 deletions
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function myvesta_replace_in_file($file, $find, $replace) {
|
function myvesta_replace_in_file($file, $find, $replace) {
|
||||||
if (!file_exists($file)) return myvesta_throw_error (3, "File '$file' not found");
|
if (!file_exists($file)) return myvesta_throw_error (MYVESTA_ERROR_FILE_DOES_NOT_EXISTS, "File '$file' not found");
|
||||||
|
|
||||||
$buf=file_get_contents($file);
|
$buf=file_get_contents($file);
|
||||||
|
|
||||||
if (strpos($buf, $find)===false) return myvesta_throw_error (4, "String '$find' not found");
|
if (strpos($buf, $find)===false) return myvesta_throw_error (MYVESTA_ERROR_STRING_DOES_NOT_EXISTS, "String '$find' not found");
|
||||||
|
|
||||||
$buf=str_replace($find, $replace, $buf);
|
$buf=str_replace($find, $replace, $buf);
|
||||||
$r=file_put_contents($file, $buf);
|
$r=file_put_contents($file, $buf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue