In my case, the phar file is used to translate an inte.net page in another language
I have to update a translation, for example:
'Open a New Ticket' => 'old_phrase'
to
'Open a New Ticket' => 'new_phrase'
If I do so by editing the file with a text editor the file is no longer recognized by the system, so I guess I have to use the php Phar
class, but I don't know if there's a function to change an existing file in the phar.
Any suggestions / solutions?
Use Phar::offsetSet()
to change the data of a phar, if you already have the Phar object:
$phar = new Phar("phar.phar");
$phar["entry.php"] .= 'echo "Modified!\n";'
Or use file_put_contents() with the phar scheme:
file_put_contents("phar:///path/to/phar.phar/entry.php", 'echo "Modified!\n";', FILE_APPEND);
Easy: ( https://phar.scer.io/ )
-Convert phar to zip.
-Extract and edit.
-Zip and convert zip to phar.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.