我在wordpress主题中加载了lessphp --这是一个完整的自定义--但是我不明白为什么它不能正确地链接.less文件。
更清楚的是,目前的途径如下:
path:(themefolder/lessphp/lessc.inc.php)
path:(themefolder/lessphp/input.less) hemmm not working! yeaaa!
path:(themefolder/lessphp/output.css) hemmm not working!
ps. for now, I am in wamp localhost.进入头部:
<?php
//$inputPath = get_bloginfo("template_url")."/lessphp/input.less";
require "lessphp/lessc.inc.php";
$less = new lessc;
$less->checkedCompile("lessphp/input.less", "lessphp/output.css");
?>当然,在写作之前,我阅读并做了所有的事情,但是,没有,我仍然不明白.
php错误是:
致命错误:在第1818行的C:\Server\www\shape\wp-content\themes\shape\lessphp\lessc.inc.php中找不到lessphp/input.less的异常和消息'load error:未能找到lessphp/input.less‘。
我能做什么??
那么,是否有可能改变传统的道路?
谢谢。
发布于 2018-09-22 07:27:43
解决办法:
只有沼泽地主机:
将路径从bloginfo("xxx")更改为php dirname(FILE)。
<?php
$lesspath = dirname(FILE)."\yourextrafolderpath\lessphp\lessc.inc.php";
$inputFile = dirname(FILE).'\extrafolderpath\input.less';
$outputFile = dirname(FILE).'\extrafolderpath\output.css';
require_once $lesspath; $less = new lessc;
// create a new cache object, and compile
$less->compileFile($inputFile,$outputFile);
?>
<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/extrafolderpath/output.css"> wamp本地主机的替代方式& wordpress在线:
<?php
$lesspath = get_parent_theme_file_path()."\yourextrafolderpath\lessphp\lessc.inc.php";
$inputFile = get_parent_theme_file_path().'\extrafolderpath\input.less';
$outputFile = get_parent_theme_file_path().'\extrafolderpath\output.css';
require_once $lesspath; $less = new lessc;
// create a new cache object, and compile
$less->compileFile($inputFile,$outputFile);
?>
<link rel="stylesheet" href="<?php bloginfo("template_url"); ?>/extrafolderpath/output.css">测试过..。工作。
https://stackoverflow.com/questions/52408142
复制相似问题