Php VQMOD替换不使用多行搜索

Php VQMOD替换不使用多行搜索,php,opencart,vqmod,Php,Opencart,Vqmod,opencart中有一个函数需要替换,如下所示: protected function validateDelete() { if (!$this->user->hasPermission('modify', 'catalog/download')) { $this->error['warning'] = $this->language->get('error_permission'); 应该是: protected fun

opencart中有一个函数需要替换,如下所示:

protected function validateDelete() {
        if (!$this->user->hasPermission('modify', 'catalog/download')) {
            $this->error['warning'] = $this->language->get('error_permission');
应该是:

protected function validateDelete() {
        if (!$this->user->hasPermission('delete', 'catalog/download')) {
            $this->error['warning'] = $this->language->get('error_permission_delete');
我试过:

<search position="replace"><![CDATA[
            protected function validateDelete() {
                if (!$this->user->hasPermission('modify',]]></search>
            <add><![CDATA[
            protected function validateDelete() {
                if (!$this->user->hasPermission('delete',
            ]]></add>
user->hasPermission('modify',]>
用户->拥有权限('删除',
]]>
但是它不工作。第三行出现在多个位置,所以不能只在一行中替换


请帮助

无法在vqmod中执行多行搜索。因此,您需要使用vqmod
索引
属性。如果“搜索”字符串为“hello”,并且文件中有5个“hello”,但您只想替换第一个和第三个,请使用索引:1,3

因此,请按以下方式更改vqmod代码:

<operation>
    <search position="replace" index="3"><![CDATA[if (!$this->user->hasPermission('modify', 'catalog/download')) {]]></search>
    <add><![CDATA[
        if (!$this->user->hasPermission('delete', 'catalog/download')) {
    ]]></add>
</operation>
<operation>
    <search position="replace" index="3"><![CDATA[$this->error['warning'] = $this->language->get('error_permission');]]></search>
    <add><![CDATA[
        $this->error['warning'] = $this->language->get('error_permission_delete');
    ]]></add>
</operation>

用户->拥有权限('修改','目录/下载'){]>
,


祝你有一个愉快的一天!!

谢谢,它起作用了,但我需要验证所需数字的发生情况。