Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: python in php

  1. #1
    Senior Coder o0O0o.o0O0o's Avatar
    Join Date
    Jan 2008
    Location
    C:\Windows\System32
    Posts
    1,018
    Thanks
    19
    Thanked 9 Times in 9 Posts

    python in php

    hi friends ,


    i want to know is it possible to call python in php

    e,g

    i have functions made in python


    is it possible to call python function in php page to and then diesplay the result through php

  • #2
    Regular Coder kokjj87's Avatar
    Join Date
    Sep 2008
    Location
    Singapore
    Posts
    279
    Thanks
    1
    Thanked 55 Times in 54 Posts

  • #3
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    test.py:
    Code:
    a = ['Mary','had','a','little','lamb'];
    for i in range(len(a)):
        print i, a[i]
    test.php:
    PHP Code:
    <?php
    passthru
    ('python ' $_SERVER['DOCUMENT_ROOT'] . 'test.py');
    ?>
    or:

    http://www.python.org/doc/essays/ppt/sd99east/index.htm

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •