我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

使用PHP设置备用(备用)映像

I'm looking to set a "backup" image as an alternate to my PHP generated image (pulling filename from SimpleXML)

<div style="background-image:url('//url.com/images/<?php echo $xml->IMGNODE; ?>.png');"></div>

Basically, if the above PHP code returns no value, I'd like to set it to a predetermined image filename rather than just showing nothing.

<div style="background-image:url('//url.com/images/<?= isset($xml->IMGNODE) ? $xml->IMGNODE : 'default_image' ?>.png');"></div>

近期文章

  • 如何检查url是否为空字符串
  • 加载php文件时发送jquery变量
  • 将数字转换为字母
  • 如何更改链接(a)元素中的href(url)?
  • 使用/ Google App Engine实现REST API
  • 在cakephp 3.0中显示Element时出现意外的回声
  • 试图开发搜索引擎,我的代码中有错误
  • 如何获得问号后的PHP值回声
  • 如何在sql中使用select ... union ...时检测结果来自哪个表
  • typeahead.js远程返回任何内容
  • 从return语句在浏览器中获取数据
  • Laravel 5 Pagination CSS Breaking
  • 内容中的正则表达式匹配
  • 使用带有成员名称的字符串变量访问类的成员
  • 使用php显示精确的数组元素
  • Google No captcha Recaptcha无效
  • php codeigniter中的界面损坏
  • 使用php框架时发布网站(laravel)[关闭]
  • 如何访问从php转换为javascript对象的实体
  • 使用foreach()函数从web目录中删除多个文件

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华