How do I execute a PHP shell script as an Automator action on Mac OS X

前端 未结 5 1116
时光说笑
时光说笑 2020-12-25 08:54

I\'m tempted by Automator.app\'s ability to create contextual services in Mac OS X Snow Leopard. I would like to create some keyboard accessible shortcuts to manipulate text

5条回答
  •  心在旅途
    2020-12-25 09:11

    This is just a hack, but how about creating a python, or ruby or perl or bash script that calls php command-line interpreter with the php script you want to execute?

    For instance in bash would be as simple as this:

    #!/bin/bash   
    php myscript.php
    

    Now save it, give it permission for execution:

    chmod +x my_bash_script.sh
    

    And voilá. Automator can now run the bash script, which calls the php script.

提交回复
热议问题