Practical php/gtk_php Tutorials

Source: Internet
Author: User
Tags gtk
Previously PHP was supposed to be used only to write server-side CGI programs, if PHP can develop a GUI (graphical user interface) program under Windows, do you believe it? Recently, the PHP development team successfully developed a bundle of GTK + PHP, then you can develop a GUI program under Windows. First, the establishment of PHP/GTK operating environment: In fact, GUI program and ordinary phpcgi program no difference, but PHP/GTK program by GTK class to generate GUI interface, they are also open source code, rely on PHP to parse the build window. If you have already set up the debugging environment of PHP, then install PHP/GTK environment is relatively simple: 1, download php_gtk.dll (this DLL file used to parse the PHP source program inside the GTK code), download and extract it to the php extension (extension) directory; 2, Download other PHP/GTK DLL files (total 6), unzip them into the System32 directory of Windows, 3, open php.ini, add "Extension=php_" at the bottom of the Extended Settings section "Windows Extensions" Gtk.dll "statement, it is recommended to back up the php.ini, to avoid the failure of the modification of the PHP operating environment to invalidate the establishment of a good environment for the PHP/GTK. Of course, you can also add "DL (Php_gtk.dll)" In the first line of each PHP/GTK program source code instead of the second step to dynamically load GTK's support. If you have not set up a PHP runtime environment, then the installation is more simple: 1, download the entire PHP/GTK bundle support package, and then unzip them to the PHP4 directory of the C drive, 2, the Winnt directory below the DLL file copied to the System32 directory of Windows, Copy the php.ini file to the Windows directory; After PHP/GTK is set up, you can run a PHP/GTK program in command-line mode with PHP: Enter "C:php4php-q Gtkprogrampath" in the Run, where "C: Php4php "to PHP.EXE's path," Gtkprogrampath "is the path to the PHP/GTK program. For example, "C:php4php-q c:php4sampleshello.php" will run the example "Hello World" program that accompanies the PHP/GTK run package. Second, compile the PHP/GTK program: If you make a PHP/GTK application, but also need the other side of the computer to build PHP environment and use the PHP command line mode to parse can be executed, it is tooIt's complicated. So how is it possible to compile a PHP/GTK program? After a search, the author found phpcompiler this software. Phpcompiler is developed by www.deskcode.com (Http://www.deskcode.com/phpcompiler), PHP can be compiled into EXE executable file, built-in PHP support, if you want to compile a php/ GTK program, you must establish the operating environment of the PHP/GTK (refer to the previous steps). The steps to compile a PHP/GTK program are as follows: 1. Open Phpcompiler (), select the PHP program source code you wish to compile in "Script to", select the path of the EXE file after the successful compilation in "Destination", 2, click "Compile" button, a dialog box will pop up asking for the compiled mode (if the PHP/GTK program chooses No, the simple phpcgi program chooses YES), 3, and then a dialog box asks if you want to copy the Php4ts.dll file to the directory of the compiled EXE file and select Yes. After the above steps, a PHP/GTK program has been compiled successfully, but for compiling the PHP/GTK program there are a few points to note: 1, after the completion of the executable file, if required to execute, The PC must have several DLL files required by the GTK runtime (the ones that were downloaded earlier), and if necessary, you can copy several DLL files to the System32 directory at installation time (though this is not a "green software" ^_^). 2, Phpcompiler itself for the support of PHP very good, but some people have tried to extend the support of some functions, such as "Gzopen" and so on, before the compilation is good, after the compilation is not ready to use. In fact, after the completion of the executable file, the equivalent of only the default PHP support (even the GTK support is not), so if you apply any function in the program that need to extend support, you must dynamically load the supporting function DLL file, such as "DL (Php_gtk.dll)", This will not be an error until the compilation is complete. 3, run a compiled executable file, will pop up a DOS window, and then automatically close, because each GUI window is "drawn" through GTK, so there must be a window. 4, perhaps before PHP can not be said to be true oop (object-oriented program) language, but to php/gtk, any window by the GTK object to "draw", if there is no strong OOP skills, it is difficult to write GUI program. Three, PHP/GTK resources: 1, http://gtk.php.net:PHP/GTK's official website; although it is the official website, but it is very simple, out of a FAQ and mailing list, almost no useful things, 2, http://www.phpgtk.com: A better interface of the PHP/GTK site, with the latest version information. 3, Http://developer.gnome.org/doc/API/gtk/gtkobjects.html:PHP/GTK function and class of the Encyclopedia/Handbook website, which has a very rich php/gtk information. 4, http://www.phpuk.org/gtk/: Unofficial version of the GTK Handbook website, easy to understand. If you think E is ugly, you can also come to zphp.com download the latest PHP/GTK Runtime environment and support package

http://www.bkjia.com/PHPjc/531697.html www.bkjia.com true http://www.bkjia.com/PHPjc/531697.html techarticle previously PHP was supposed to be used only to write server-side CGI programs, if PHP can develop a GUI (graphical user interface) program under Windows, do you believe it? Recently, the development team of PHP successfully ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.