有没有办法在HTML5视频上设置缩略图?我想在比赛前看一些照片.我的代码看起来像这样:
<video width="470" height="255" controls>
<source src="video.mp4" type="video/mp4">
<source src="video.ogg" type="video/ogg">
<source src="video.webm" type="video/webm">
<object data="video.mp4" width="470" height="255">
<embed src="video.swf" width="470" height="255">
</object>
</video>
Run Code Online (Sandbox Code Playgroud)
谢谢!
我有一个问题:我想设置PHP和htaccess来创建动态子域.我无法弄清楚如何.目前我的网址如下所示:
www.exemple.com/index.php?subdomain=mike&component=content&id=26&title=people-love-apps
Run Code Online (Sandbox Code Playgroud)
我需要它看起来像这样:
www.mike.exemple.com/content/26/people-love-apps.html
Run Code Online (Sandbox Code Playgroud)
我知道可以做到,但我不知道如何做到这一点的解决方案.用$ _GET []函数读取URL中的参数对我来说非常重要.
问题是我网站上的用户自己创建了自己的网站并获得了免费域名(子域名).这应该是自动的.
谢谢!
我使用Bootstrap v.3.3.7并拥有一个动态内容编辑器.该编辑器的所有选项都存储在popover中.
我有一个问题,当一些内容位于底部或顶部时,因为弹出式推送内容和整个页面.以下是示例:
我通常想要,如果popover超出边距以自动改变位置.它从窗口的顶部向外突出到底部或者如果完全在底部显示位置顶部.
使用AJAX上传多个图像有很多问题.我写这段代码:
HTML
<form id="upload" method="post" enctype="multipart/form-data">
<div id="drop" class="drop-area">
<div class="drop-area-label">
Drop image here
</div>
<input type="file" name="file" id="file" multiple/>
</div>
<ul class="gallery-image-list" id="uploads">
<!-- The file uploads will be shown here -->
</ul>
</form>
<div id="listTable"></div>
Run Code Online (Sandbox Code Playgroud)
jQuery的/ AJAX
$(document).on("change", "input[name^='file']", function(e){
e.preventDefault();
var This = this,
display = $("#uploads");
// list all file data
$.each(This.files, function(i, obj){
// for each image run script asynchronous
(function(i) {
// get data from input file
var file = This.files[i],
name = file.name, …
Run Code Online (Sandbox Code Playgroud) 我需要在插件付款之前显示购物车中的订单详情.
我在一个插件上工作,连接woocommerce和支付API,我需要发送产品ID,名称,描述,数量和个人数量等产品详细信息.
我的问题是我找不到正确的钩子来正确获取所有数据.
我怎样才能获得这些数据?
谢谢
这里是基于anwers的更新,为每个需要它的人提供:
add_action('woocommerce_checkout_process', 'woocommerce_get_data', 10);
function woocommerce_get_data(){
$cart = array();
$items = WC()->cart->get_cart();
foreach($items as $i=>$fetch){
$item = $fetch['data']->post;
$cart[]=array(
'code' => $fetch['product_id'],
'name' => $item->post_title,
'description' => $item->post_content,
'quantity' => $fetch['quantity'],
'amount' => get_post_meta($fetch['product_id'], '_price', true)
);
}
$user = wp_get_current_user();
$data = array(
'total' => WC()->cart->total,
'cart' => $cart,
'user' => array(
'id' => $user->ID,
'name' => join(' ',array_filter(array($user->user_firstname, $user->user_lastname))),
'mail' => $user->user_email,
)
);
$_SESSION['woo_data']=json_encode($data);
}
Run Code Online (Sandbox Code Playgroud)
感谢@loictheaztec和@ raunak-gupta
我对某些事情感到困惑,需要一些解释。
在我的实践中,我通常看到 90% 的 PHP 开发人员所有敏感信息(如数据库连接、FTP、SMTP 设置等)都存储在一些变量、数组、对象或常量中。
我想知道现在使用 root 之外的一些 ini 文件并存储在那里更好吗?或者最好将 .ini 文件隐藏在某个地方并通过 .htaccess 拒绝访问?
一般来说,我想以最安全的方式保存敏感数据。
我正在开发针对woocommerce的商家安全Unipay(MSU)的自定义API,并且需要在成功付款后更改数量.
这是过程:
一切运作良好,但无法找到钩子在哪里以及如何标记所有产品从购物卡支付和更改数量.
我怎样才能做到这一点?
谢谢
我有一个这样的字符串:
Free-coffee and coffee-free is free coffee
Run Code Online (Sandbox Code Playgroud)
我只需要匹配和替换单独的单词free
而不是单词{Free}-coffee
和coffee-{free}
想法是在字符串中标记坏词并添加这样的HTML标签<strong>
:
Free-coffee and coffee-free is <strong>free<strong> coffee.
Run Code Online (Sandbox Code Playgroud)
我尝试使用空格,但如果在这句话之前有空格,有时会失败。
这是我当前的正则表达式:
/(\sfree\s|\sfree|free\s)/ig
Run Code Online (Sandbox Code Playgroud)
注意:这需要不区分大小写。
这是代码示例:
var text = "Free-coffee and coffee-free is free coffee";
text = text.replace(/(\sfree\s|\sfree|free\s)/ig, " <strong>strong</strong> ");
Run Code Online (Sandbox Code Playgroud)
请帮帮我。
有趣的问题发生在我今天,我无法比较2个版本的WordPress安装.
注意:我想比较WordPress版本,而不是PHP版本.
我尝试这样的例子:
if(version_compare(get_bloginfo('version'),'3.5') >= 0)
echo 'Wordpress Version same or above 3.5';
else
echo 'Wordpress Version below 3.5';
Run Code Online (Sandbox Code Playgroud)
哪里弄错了?
我得到-1并且需要1为WordPress版本4.7.2 get_bloginfo()
返回什么.
我在本地PHP7中使用,但我的客户端将使用PHP5.6,PHP5.4或无所事事.
php ×5
wordpress ×3
html ×2
javascript ×2
jquery ×2
woocommerce ×2
.htaccess ×1
ajax ×1
cart ×1
css ×1
file-upload ×1
html5 ×1
html5-video ×1
ini ×1
json-ld ×1
matching ×1
orders ×1
preloading ×1
regex ×1
schema.org ×1
security ×1