天天看點

用PHP開發桌面應用程式

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.

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”.

用PHP開發桌面應用程式

圖檔1.jpg

5)  You will get an output “hello world!”.

用PHP開發桌面應用程式

圖檔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/

php