php + BAT production PHP self-resolved batch processing

Source: Internet
Author: User
Tags goto key php cli php code
About the title: PHP + BAT production PHP self-resolution batch processing

That is, a bat file that contains the DOS bat batch code and the PHP CLI code internally.
Because the suffix name is bat, so on the Windows system, I dot him and he can run it automatically

Because I did some special processing for PHP, it was able to use the PHP CLI itself to parse the PHP instructions it contained.

What is the use of:
For example, if you want to make a PHP-CLI release package, then you can refer to this script to do your own installer.


Original code:
Filename:phpbat.bat
[code:1:e6cfde5612]
@REM <?php
@REM = = '
@SET Phpcli=f:\usr\local\php4\php.exe
@REM PHPCLI represents the path to Php.exe of your CLI pattern
@%phpcli%%0
@goto: EOF
@REM ';? >
<?php
echo "\rhello World";
EXEC ("pause");
?>
[/code:1:e6cfde5612]

A bit of a description, cleverly using the bat batch of REM instructions and PHP's ' definition of strings, so that the two mixed together, but complementary interference.

Another point to note:
Just in a QQ group, give this proposition, incredibly some people say that the backward technology, idle nothing to do, incredibly say like? I like this son of garbage people, no way, good things I want to share to everyone.

Reference: ActivePerl windows Zip packge installer.bat

BKKKD back in: 2005-04-09 09:04:18 interesting, but not very clear!

Honestqiao back in: 2005-04-09 23:48:10 that is, how to integrate batch code and PHP code into a file, followed by the name of bat, then it can run its own bat code, The bat code then invokes PHP-CLI to run its own PHP code.

Dualface back to: 2005-04-10 23:57:56 good wen! Be creative!

The key is:
@REM <?php
And
@%phpcli%%0
@goto: EOF

: em03:

Henkoo back in: 2005-04-12 10:25:31 I seem to be adding ob_flush here.
[CODE:1:B4A62B2F1B]
@REM <?php
@REM = = '
@SET Phpcli=f:\php\php.exe
@REM PHPCLI represents the path to Php.exe of your CLI pattern
@%phpcli%%0
@goto: EOF
@REM ';? >
<?php
echo "\rhello World";
Ob_flush ();
EXEC ("pause");
?>
[/CODE:1:B4A62B2F1B]

Bluedoor007 back to: 2005-04-12 18:44:23 good! After watching it, it was very rewarding.

Honestqiao back to: 2005-04-14 16:16:28 [quote:7726d7b1d3= "Henkoo"][/quote:7726d7b1d3]

Oh, I wrote just the main idea, the code is not the most perfect, but can achieve a certain demonstration effect.

As for how to apply in their own projects, it is the beholder, benevolent

Gydoesit back to: 2005-04-19 14:43:18 landlord High!!!
But I do not understand REM instructions, I just remember the comment, this line does not work. Can't think of a part of it that can be used?
Please explain to the landlord in detail. How does the PHP behind the implementation also do not understand.

In addition, please give some ideas, see what this can help to achieve some of the commonly used applications. I know that should not be just hello world, also feel that the scope of application seems to be only unexpected, not to do, but the moment is really not remember.

In addition, after this thing is executed there
Content-type:text/html
x-powered-by:php/4.3.10

@REM
Such a display, looks uncomfortable, there is no way to remove

Honestqiao back to: 2005-04-19 14:59:39 haha, with php-cli there is no.
If you use php-cgi, you have it.

The other role, depends on how you go to toss it.

REM is the function of annotations.
Put on his back [Code:1:d0ad0a047f]< [/code:1:d0ad0a047f] is to prevent the DOS batch parsing PHP content;

Php-cli to parse PHP, just parse [Code:1:d0ad0a047f]<?? >[/code:1:d0ad0a047f] The contents of this

Lbyyy back to: 2005-04-20 17:48:41 with php-cli display as:

@REM
Hello World

Honestqiao back to: 2005-04-22 22:23:28 Oh, this is the beginning of the @rem
In fact, you can change the number of lines or change the screen can be.

IAMCM back in: 2005-04-24 14:15:16 had to admire.

It seems that the landlord's Dos Kungfu is also very deep oh, the key or thinking, I think.

Honestqiao back to: 2005-04-25 09:36:24 [quote:48b011a442= "IAMCM"] had to admire.

It seems that the landlord's Dos Kungfu is also very deep oh, the key or thinking, I think. [/quote:48b011a442]

Oh, do wapm control script, all written in batch processing, spent a little time to read a little more


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.