【发布时间】:2019-11-03 12:10:30
【问题描述】:
我想使用 CakePHP 在我的页面中插入一个评级星。图像的路径在 javascript 中,如下所示。但是,图像没有显示。
$.fn.jRating = function(op) {
var defaults = {
/** String vars **/
bigStarsPath : '../img/icons/stars.png' , // path of the icon stars.png
smallStarsPath : '../img/icons/small.png', // path of the icon small.png
phpPath : 'app/jRating.php', // path of the php file jRating.php
type : 'big', // can be set to 'small' or 'big'
我已经尝试使用<?php echo $this->webroot; ?>img/icons/stars.png。但没有运气。谁能帮帮我。
【问题讨论】:
-
使用绝对网址 - 你为什么要引用“应用程序”?
-
对不起,我不明白你的意思。你能解释一下'绝对网址'
-
bigStarsPath : '..Here's a similar question with the same problem -
我已经尝试过 bigStarsPath : 'img/icons/stars.png',但图像仍然没有显示。
-
这并不奇怪,因为这也是一个相对路径。查看您请求的图像(使用浏览器的开发工具或服务器访问日志)并将其与图像的实际位置进行比较。
标签: javascript php cakephp