从 PHP 执行 SASS 脚本并获取输出 [英] Executing SASS script from PHP and getting output

查看:44
本文介绍了从 PHP 执行 SASS 脚本并获取输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个 PHP 脚本 (test.php):

I have this PHP script (test.php):

<?php

    $cmd = "/usr/bin/sass --watch file1.scss";

    system($cmd);

?>

现在我以这种方式从 CLI 调用我的 PHP 脚本:

Now I call my PHP script from CLI this way:

/usr/bin/php test.php

我没有得到任何输出(它应该打印 SASS is watch for changes).

And I get no output (it should print SASS is watching for changes).

如果我直接从 shell 调用 SASS 命令,它会正确输出.

If I call the SASS command directly from the shell, it outputs correctly.

为什么?

信息:我在 OS X Lion 上使用 PHP 5.3.6 版本

Info: I'm using the PHP 5.3.6 version on OS X Lion

编辑:请注意,此命令会监视更改,它的行为似乎与常规命令不同.

Edit: Please, note that this command watches for changes, it seems to behave differently to a regular command.

Edit2:命令有效,编译正确.唯一缺少的是输出(我想调试并查看错误:)

Edit2: The command works, it compiles correctly. The only thing lacking is the output (I want to debug and see errors :)

推荐答案

一些命令行实用程序,如 sass,以某种 PHP 无法使用的方式操作输出管道.

Some command line utilities like sass, manipulate the output pipe in some way that PHP can't use.

因此,在这种特殊情况下,没有解决方案.

So, in this particular case, there is no solution.

这篇关于从 PHP 执行 SASS 脚本并获取输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆