ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 用PHP开发桌面应用程序

用PHP开发桌面应用程序

原创 Linux操作系统 作者:jieforest 时间:2012-06-16 00:53:43 0 删除 编辑
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:

$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/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-04-23

  • 博文量
    443
  • 访问量
    508549