Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
LESS.php-它将编译后的文件保存在哪里?_Php_Html_Css_Twitter Bootstrap_Less - Fatal编程技术网

LESS.php-它将编译后的文件保存在哪里?

LESS.php-它将编译后的文件保存在哪里?,php,html,css,twitter-bootstrap,less,Php,Html,Css,Twitter Bootstrap,Less,我正在尝试设置一个php-LESS解析器:LESS.php() 我已经根据示例编写了一个基本代码: <?php require_once 'less.php/Less.php'; $parser = new Less_Parser(); $parser->parseFile( 'Z:\home\test1\www\assets\bootstrap\less\bootstrap.less', 'test' ); $css = $parser->getCss();

我正在尝试设置一个php-LESS解析器:LESS.php()

我已经根据示例编写了一个基本代码:

<?php
  require_once 'less.php/Less.php';

  $parser = new Less_Parser();
  $parser->parseFile( 'Z:\home\test1\www\assets\bootstrap\less\bootstrap.less', 'test' );
  $css = $parser->getCss();
?>


这将从给定文件夹编译bootstrap.less文件。它工作正常,但是我不确定它将编译的css文件保存在哪里?我可以指定它的目的地吗?任何帮助都将不胜感激。

根据其文档,
getCss
不会保存CSS。实际上,变量
$css
将包含css。要将
$css
的值写入磁盘,请使用例如
file\u put\u contents
。即:

<?php
require_once 'less.php/Less.php';

$parser = new Less_Parser();
$parser->parseFile( 'Z:\home\test1\www\assets\bootstrap\less\bootstrap.less', 'test' );
$css = $parser->getCss();

// And now to write the contents:
file_put_contents("output.css", $css);
?>

根据其文档,
getCss
不保存CSS。实际上,变量
$css
将包含css。要将
$css
的值写入磁盘,请使用例如
file\u put\u contents
。即:

<?php
require_once 'less.php/Less.php';

$parser = new Less_Parser();
$parser->parseFile( 'Z:\home\test1\www\assets\bootstrap\less\bootstrap.less', 'test' );
$css = $parser->getCss();

// And now to write the contents:
file_put_contents("output.css", $css);
?>


谢谢你的邀请。我对PHP不太熟悉,所以在这一点上我有点困惑。谢谢这个Martijn。我对PHP不太熟悉,所以在这一点上我有点困惑。