Heim > Backend-Entwicklung > PHP-Tutorial > php aop-php扩展怎么安装?

php aop-php扩展怎么安装?

PHPz
Freigeben: 2020-09-05 13:38:49
Original
1881 Leute haben es durchsucht

php aop-php扩展的安装方法:首先打开终端命令窗口;然后通过执行命令“sudo pecl install aop-beta”来安装“aop-php”扩展即可。

php aop-php扩展怎么安装?

AOP为Aspect Oriented Programming的缩写,意为:面向切面编程(也叫面向方面),可以通过预编译方式和运行期动态代理实现在不修改源代码的情况下给程序动态统一添加功能的一种技术。

AOP实际是GoF设计模式的延续,设计模式孜孜不倦追求的是调用者和被调用者之间的解耦,AOP可以说也是这种目标的一种实现。

aop-php简介

AOP-PHP是一个PECL扩展,您可以在PHP中使用面向方面的编程,无需编译或进行其他任何中间步骤。

AOP扩展的设计是最简单的方法,你可以认为PHP中的aop实现。

AOP旨在让横切关注点的分离(缓存,日志,安全,交易,……)

aop-php安装

AOP-PHP有两种安装模式:

第一种方法:

sudo pecl install aop-beta  
Nach dem Login kopieren

第二种方法:

#Clone the repository on your computer
    git clone https://github.com/AOP-PHP/AOP
    cd AOP
    #prepare the package, you will need to have development tools for php
    phpize
    #compile the package
      ./configure --with-aop --with-php-config=/usr/bin/php-config 

    make
    #before the installation, check that it works properly
    make test
    #install
    make install
Nach dem Login kopieren

第二种方法安装中可能出现的错误:

Can't locate Autom4te/C4che.pm in @INC (@INC contains: /usr/local/share/autoconf...
Nach dem Login kopieren

解决办法是重新安装autoconf:

#wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
#tar -zxf autoconf-latest.tar.gz
#rpm -qf /usr/bin/autoconf #查看autoconf的版本
#rpm -e --nodeps autoconf-2.59-12 #卸载原来版本
#./configure --prefix=/usr
#make && make install
Nach dem Login kopieren

编译安装成功后,需要在php.ini里装载模块,一般在centos里php的模块装载在/etc/php.d里面,新建一个文件aop.ini ,内容为:

extension=aop.so
Nach dem Login kopieren

 安装成功后查看phpinfo,会看到一下内容:

1.gif

关于aop的一些专业术语。

  • Aspect(切面):横向切面关系被成组的放进一个类中。

  • Advice(通知):用于调用切面,定义某种情况下做什么和什么时间做这件事情。通知又分为:前通知、返回后通知、抛出后通知和周边通知。

  • Joinpoint(接入点):创建通知的位置。

  • Pointcut(点切割):定义了一种把通知匹配到某些接入点的方式。

更多相关知识,请访问 PHP中文网!!

Verwandte Etiketten:
php
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Aktuelle Ausgaben
PHP-Datenerfassung?
Aus 1970-01-01 08:00:00
0
0
0
PHP-Erweiterung intl
Aus 1970-01-01 08:00:00
0
0
0
Wie man PHP gut lernt
Aus 1970-01-01 08:00:00
0
0
0
Mehrere PHP-Versionen
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage