PHP可以开发桌面程序,不要怀疑这一点,请听我一一道来。
Most of us are familiar with PHP Web Applications. But PHP standalone application is something new. Now we can make standalone applications with PHP GTK. This how you will create your first destkop Application dispalying ‘hello world!’ using PHP GTK.
1) You can get PHP GTK for download from http://gtk.php.net/download.php
Just Download php-gtk-2.0.1 Windows binary pack.
2) Put the extracted folder in “c:\php-gtk2″.
3) Save the following code in hello.php file.
$window = new GtkWindow();
$window->connect_simple(‘destroy’, array(‘Gtk’,'main_quit’));
$label = new GtkLabel(“hello world!”);
$window->add($label);
$window->show_all();
Gtk::main();
?>4) That’s it now you can execute this code by “c:\php-gtk2\php hello.php”.
图片1.jpg
5) You will get an output “hello world!”.
图片2.jpg
For more tutorials visit http://gtk.php.net/manual/en/tutorials.php For any queries or questions comment or contact us.
Most of us are familiar with PHP Web Applications. But PHP standalone application is something new. Now we can make standalone applications with PHP GTK. This how you will create your first destkop Application dispalying ‘hello world!’ using PHP GTK.
1) You can get PHP GTK for download from http://gtk.php.net/download.php
Just Download php-gtk-2.0.1 Windows binary pack.
2) Put the extracted folder in “c:\php-gtk2″.
3) Save the following code in hello.php file.
CODE:
<?php$window = new GtkWindow();
$window->connect_simple(‘destroy’, array(‘Gtk’,'main_quit’));
$label = new GtkLabel(“hello world!”);
$window->add($label);
$window->show_all();
Gtk::main();
?>4) That’s it now you can execute this code by “c:\php-gtk2\php hello.php”.
图片1.jpg
5) You will get an output “hello world!”.
图片2.jpg
For more tutorials visit http://gtk.php.net/manual/en/tutorials.php For any queries or questions comment or contact us.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/301743/viewspace-732999/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/301743/viewspace-732999/