PHP Developing Windows desktop application instances

Source: Internet
Author: User
Tags gtk

PHP Developing Windows desktop application instances

php_gtk2.0 Developing desktop applications

PHP GTK official website

http://gtk.php.net/

The official Chinese manual for GTK is available in the manual for specific installation.

A simpler approach is to use another software name called Gnope.

Download Address: http://www.gnope.org/download.php

The installation process is easy to install and there will be a PHP-GTK2 applications shortcut icon on the desktop.

Double click on the icon will appear in a PHP desktop program listing all the demo has a control demo and games (if you choose to install the game installation)

The application is explained in detail:
Http://www.16ec.com/tp15/site/index.php and Http://blog.csdn.net/zhangking/archive/2010/08/20/5825416.aspx

I've seen these programs. You can't wait to write a desktop app for yourself.

A simple login procedure is given below:

PHP code

 Get_text ();      $strPassword = $txtPassword->get_text ();      $errors = null;      if (strlen ($strUsername) = = 0) {$errors. = "Username is missing.\r\n";      } if (strlen ($strPassword) = = 0) {$errors. = "No password given.\r\n"; if ($errors!== null) {$dialog = new Gtkmessagedialog ($wnd, GTK::D ialog_modal, Gtk::message_          ERROR, GTK::BUTTONS_OK, $errors); $dialog->set_markup ("The following errors occured:\r\n". "" . $errors. ""          );          $dialog->run ();      $dialog->destroy ();      } else {$wnd->destroy ();  }} $wnd = new Gtkwindow ();  $wnd->set_title (' Login ');  $wnd->connect_simple (' Destroy ', Array (' GTK ', ' main_quit '));  $txtUsername = new Gtkentry ();  $txtPassword = new Gtkentry ();  $lblUsername = new Gtklabel (' _username ', true);  $lblPassword = new Gtklabel (' _password ', true);  $btnLogin = new Gtkbutton (' _login ');  $btnCancel = new Gtkbutton (' _cancel ');  $lblUsername->set_mnemonic_widget ($txtUsername);  $lblPassword->set_mnemonic_widget ($txtPassword);  $btnCancel->connect_simple (' clicked ', Array ($wnd, ' destroy '));  $btnLogin->connect_simple (' clicked ', ' login ', $wnd, $txtUsername, $txtPassword);  $TBL = new Gtktable (3,2);  $tbl->attach ($lblCredit, 0,2,0,1);  $tbl->attach ($lblUsername, 0,1,1,2);  $tbl->attach ($txtUsername, 1,2,1,2);  $tbl->attach ($lblPassword, 0,1,2,3);  $tbl->attach ($txtPassword, 1,2,2,3);  $bbox = new Gtkhbuttonbox (); $bbox-≫set_layout (Gtk::buttonbox_edge);  $bbox->add ($btnLogin);  $bbox->add ($btnCancel);  $vbox = new Gtkvbox ();  $vbox->pack_start ($TBL);  $vbox->pack_start ($bbox);  $wnd->add ($vbox);  $lblHello = new Gtklabel ("This is my first PHP talbe Application\nhaha");  $wnd->add ($lblHello);  $wnd->show_all ();  Gtk::main ();   ?>

Install on Windows using Gnope

Using Gnope to install and maintain PHP-GTK on Windows 2 has proven to be almost the simplest method. The Gnope is a full-featured PHP-GTK 2 installation package that includes PHP 5.1, GTK 2.6, and PEAR. Simply click on a few mouse clicks and you can complete the installation!

Just download the installation package from gnope.org and follow the on-screen instructions. Gnope also has its own PEAR automatic installation channel, where you can download PHP-GTK 2 programs to add to the official PEAR package. For example from GTK2 category.

Manual Installation

Download PHP-GTK 2 for the Alpha version of Windows binary release package from the PHP-GTK 2 download page. Unzip the file to the specified directory. A directory named PHP-GTK will be created and contain all the contents of the release version.

You need Php.exe (CLI version) and Php5ts.dll, both available from the Windows release of PHP 5 and placed in the PHP-GTK directory. If you want to use the other extensions of this php.exe, make sure you have stored the binaries here.

After that, you must set the environment variable PATH to include the gtk+2.6.9 directory in the release package. You can also have the batch file Gtkpath.bat set the appropriate PATH variable at run time for the current command line session.

Compiling from CVS

This contains only the most important steps to install PHP-GTK 2 on Windows. If you want to learn more, get win32/readme.win32.txt and read from CVS.

From:http://gtk.php.net/manual/zh_cn/html/tutorials/tutorials.installation.windows.html

=============
Winbinder allows phper to develop desktop software in window Systems

Winbinder is an open source PHP dynamic extension (. dll), which is also a scripting language that provides the UI for PHP development under Windows, which is responsible for invoking window's API interface. It runs PHP programmers to easily create Windows applications using PHP. Of course, this can only run under Windows. itself is a software that PHP programmers can develop through this software interface. The official website is very good, no need to compile PHP. Just save the file extension to. phpw, and then open it with Php.exe to run. The concrete development feeling how, must experiment only then to know. The initial feeling will not be worse than PHP-GTK.

You can download the package to Winbinder here, under the. zip package, which is generally not required for the. exe. After the completion of the decompression, the Winbinder_xxx\php\php4\ext directory (if using PHP5 copy PHP5 directory) Php_winbinder.dll copied to the PHP extension directory, generally in C:\php\extensions , and then modify the php.ini file, plus:

Extension=php_winbinder.dll

Then go to the Open command Line (CMD) and go to the Winbinder_xxx\code\samples directory and run:

C:phpcliphp.exe MANYTESTS_MAIN.PHPW

So you can see the Windows window, test with a lot of examples, you can try. I tried the Chinese, or support good, think about it, Winbinder is the extension of the way, loaded into PHP, which is called by the Windows APIs. In fact, the winbinder can be divided into two tiers, one layer is the bottom, called the API layer, as a PHP extension directly connected to Windows API, and for the second layer (high-level, called PHP layer) to provide a unified calling interface.

Hello, World code example

 
  

Installation and configuration of the installation version of the Winbinder

First go to http://winbinder.org/files/WinBinder-0.46.0.exe download Winbinder, this is a version of the installation, download after double-click installation.

When the installation is complete, click OK. Can do the 10th step.

After installing, open D:\WinBinder\phpcode\examples, and either find a file with a. phpw extension, and select Open with D:\WinBinder\binaries\php51\php-win.exe.

It is now possible to run files with the. phpw extension. For example

Here are a few questions to explain.
1: We can choose to open the way there are three kinds, respectively, is Php.exe php-win.exe php-cgi.exe if the open mode is selected Php-cgi.exe
Then at run time, there will be a command prompt window appears, in the actual application of this window may seem redundant, but in the debugging time is very useful oh
He is able to prompt you for errors in your program.

2: Just now we have chosen to open the way for the. exe file under D:\WinBinder\binaries\php51\, there may be a friend to ask, why can't choose the installed PHP (assuming the d:/php) folder in the Local. exe file? In fact, it is possible, but there is a problem, if you choose the PHP folder under the. exe file, then it is using the php.ini configuration file under C:\Windows, so that the Winbinder runtime loaded DLL file, is actually d:/php/ext/ Files in the folder. So this time you need to set the Extension_dir in php.ini to./ext because the Ext folder is in the same folder as the. exe file (that is, the D:\php folder). Then you need to put the Php_winbinder.dll file in the D:\WinBinder\binaries\php51\ext into D:\php\ext, and then the corresponding php.ini in C:\Windows Add Extension=php_winbinder.dll to the file. In addition, if you need to use the corresponding library file, you need to php.ini in the corresponding file name before; Number, I think we all know it.

If you choose to open an. exe file under D:\WinBinder\binaries\php51\, it is not so troublesome, it uses the php.ini file under D:\WinBinder \binaries\php51\, You can use it without any configuration, but he only supports both MySQL and SQLite libraries, and if you want to use other libraries such as GD then you need to modify the php.ini file under D:\WinBinder\binaries\php51\. The corresponding library file (for example, Php_gd.dll) is then placed under D:\WinBinder\binaries\php51\ext.

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