Graphical User Interface (GUI) extension
Read the PHP manual today At that time, I saw that PHP7 has an extension to the ui graphics library, so we rushed to use it
Install the extension
The installation steps in the official manual are for Linux:
Requirements: PHP 7 libui (use current master) Windows/MacOSX/Linux (GTK-3) Install re2c: sudo apt install re2c Install libui: git clone https://github.com/andlabs/libui.git cd libui sudo cp *.h /usr/local/include/ cmake . cd out sudo cp * /usr/lib/ Install ui: Method one: use pecl: sudo pecl install channel://pecl.php.net/ui-2.0.0 Method two:build source code: git clone https://github.com/krakjoe/ui.git cd ui phpize make sudo make install Enable ui.so: sudo echo 'extension=ui.so' > /etc/php/7.0/mods-available/ui.ini sudo ln -s /etc/php/7.0/mods-available/ui.ini 20-ui.ini Test: php -m git clone https://github.com/krakjoe/ui.git cd ui/examples/ php snake.php
Requirements (documentation says)
- PHP 7
- libui (use current master)
- Windows/MacOSX/Linux (GTK-3)
Download the windows dll from PECL. I am using php7 nts 64-bit, so I used this:
Downloaded file directory structure:
Next:
php_ui.dll is placed in the ext directory of php, and then php.ini is added to extension =php_ui.dll
- ##pthreadVC2.dll and libui.dll are placed in the php directory, which is the same level as the php.exe file
- Run the php -m command in cmd to check whether the module is loaded correctly
##Test a glutton Snake
There is a snake.php file (Snake game) in the folder where the ui extension is downloaded. Go to this directory and run:
php snake.php
In addition There is also a particle effect file (starfield.php):
Recommended learning: "