Smarty中有没有一种方法来获取字符串的文件扩展名。我一直在寻找等效的爆炸物,尽管似乎什么也找不到。
我想根据文件类型显示其他图标。doc,docx,pdf
我正在尝试建立一个cron作业,每天在虚拟机上使用debian来优化mysql数据库.
首先我尝试使用mysqlcheck,如下所示:
0 * * * * mysqlcheck -Aao –auto-repair -u root -p[password] > /dev/null
Run Code Online (Sandbox Code Playgroud)
我收到此错误:mysqlcheck:收到错误:1045:尝试连接时用户'root'@'localhost'(使用密码:YES)拒绝访问
谷歌搜索此错误后,我发现Dave Stoddard 评论谁遇到了同样的问题:
0 * * * * /usr/local/bin/mysqlcheck --defaults-file=/root/.my.cnf --all-databases --auto-repair 2>&1 | grep -v "OK" | mail -s "Database Problem" root
Run Code Online (Sandbox Code Playgroud)
要么 0 * * * * /usr/local/bin/mysqlcheck --defaults-file=/root/.my.cnf --all-databases --auto-repair 2>&1 | grep -v "OK" | mail -s "Database Problem" root
上面的错误:
/bin/sh: root: command not found
/bin/sh: /usr/local/bin/mysqlcheck: No such file or directory
Run Code Online (Sandbox Code Playgroud) 目前我有:
//replace common characters
$search = array('&', '£', '$');
$replace = array('&', '£', '$');
$html= str_replace($search, $replace, $html);
Run Code Online (Sandbox Code Playgroud)
此代码的问题是,如果&已经转换,它将尝试再次转换它.我怎样才能确保不会发生这种情况?
我遇到了另一个开发人员编写的代码,我无法弄清楚它在做什么:
title.replace(/(<([^>]+)>)/ig," ")
Run Code Online (Sandbox Code Playgroud) 该|explode:","部分的代码下面似乎并不合作,并在foreach $widgets_ids只有永远循环一次.我已经尝试添加{$widgets_ids}调试和显示Array,所以它是一半工作.
{foreach $layout_containers.rows as $row}
<td class="layout_container" data-cid="{$row.container_id.fvalue}">
Container: <strong>{$row.container_key.fvalue}</strong>
<br />
<a class="btnMed" rel="rename_container" href="javascript:;">Rename</a>
<a class="btnMed" rel="delete_container" href="javascript:;">Delete</a>
{if $row.widgets_ids.value}
{assign var="widgets_ids" value=$row.widgets_ids.fvalue|explode:","}
{foreach $widgets_ids as $widgets_id}
{assign var="widget" value=$widgets.rows[$widgets_id]}
<div data-widget="{$widget.id.fvalue}" class="widget ui-draggable">
<img align="middle" src="{$HOME}{$TEMPLATE_HOME}/admin/images/icons/drag_drop.png" alt="{$widget.name.fvalue}" />
{$widget.name.fvalue}
</div>
{/foreach}
{/if}
{* droparea widget *}
<div class="drop_area">drop area</div>
</td>
{/foreach}
Run Code Online (Sandbox Code Playgroud)
发送到页面的输出数组:
[widgets] => Array
(
[type] => Table
[rowcount] => 5
[name] => widgets
[rows] => Array …Run Code Online (Sandbox Code Playgroud) 我试图默认隐藏按钮,它们只有在鼠标结束时才会显示.虽然我在旋转木马核心代码似乎添加了显示块的问题,即使我在CSS中设置了display none.
var $slides = $("#slides");
$slides.find('ul.banners').eq(0).carouFredSel({
height: 360,
items: {
visible: 1
},
scroll: {
easing: "easeInOutSine",
duration: 1200
},
auto: {
delay: 1000
},
prev: {
button: $slides.find('.prev'),
items: 1
},
next:{
button: $slides.find('.next'),
items: 1
},
pagination: {
container: $slides.find(".pagination"),
keys: true,
anchorBuilder: function(nr) {
return '<li><a href="#"><span>'+nr+'</span></a></li>';
}
}
});
$slideButtons = $slides.find(".next,.prev");
$slides.find('ul.banners').hover(function(){
$slideButtons.fadeIn();
},function(){
$slideButtons.fadeOut();
});
Run Code Online (Sandbox Code Playgroud)
HTML
<div id="slides">
<ul class="banners">
<li><img /></li>
<li><img /></li>
</ul>
<ul class="pagination"></ul>
<div class="next">Next</div>
<div class="prev">Previous</div>
</div>
Run Code Online (Sandbox Code Playgroud) 例如:Lorem ipsum dolor sit amet,[ID:123] Suspendisse [blahsh 68] condimentu
我怎么会得到123?
我有第一部分,我检查角色位置:
$pos = strrpos($l, "ID: ");
if ($pos === false) {
$id = 123;
}
Run Code Online (Sandbox Code Playgroud) 我试图从父目录中包含一个 php 文件,但出现错误:
admin@webby:~$ /usr/bin/php /var/phpscripts/email_parser/tests/_email-test.php PHP 致命错误:require_once(): 无法打开所需的 '../PlancakeEmailParser.php' (include_path='. :/usr/share/php:/usr/share/pear') 在 /var/phpscripts/email_parser/tests/_email-test.php 第 6 行
致命错误:require_once(): 在 /var/phpscripts/email_parser/tests/_email 中打开所需的 '../PlancakeEmailParser.php' (include_path='.:/usr/share/php:/usr/share/pear') 失败-test.php 第 6 行
PHP文件
#!/usr/bin/php
<?php
error_reporting(E_ALL ^ E_NOTICE ^E_WARNING);
ini_set("display_errors" , 1);
require_once("../PlancakeEmailParser.php");
// etc
?>
Run Code Online (Sandbox Code Playgroud)
文件夹结构
admin@webby:/var/phpscripts/email_parser$ find .
.
./composer.json
./README.txt
./LICENSE.txt
./PlancakeEmailParser.php
./tests
./tests/_email-test.php
Run Code Online (Sandbox Code Playgroud)
为了进行测试,当我PlancakeEmailParser.php进入tests目录并从 require 中删除“../”时它工作正常
是否可以一次为vqmod生成所有vqcache文件?
我希望在服务器负载较低时运行此脚本一次,它将遍历所有qmod文件并应用所有更改,准备好并等待高负载.
这也会提醒我任何vqmod错误,而不必等待它们发生.
E,g当我安装/卸载扩展时我还需要卸载vqmod扩展:
/**
* install/uninstall vqmod files for extension
*
* @param string $action = install/uninstall
*/
private function _vqmodAction($action){
$vqmod_path = str_replace("system", "vqmod", DIR_SYSTEM);
// Clear vqmod cache
$files = glob($vqmod_path.'vqcache/vq*');
if ($files) {
foreach ($files as $file) {
if (file_exists($file)) {
@unlink($file);
clearstatcache();
}
}
}
// Force vqmod to re-generate cache
global $vqmod;
$vqmod->modCheck(DIR_SYSTEM . 'startup.php');
// Re-name vqmod files
$vqmod_xml_path = $vqmod_path . "xml/";
$vqmod_files = array('file', 'file_languages', 'file_admin');
foreach($vqmod_files as $filename){
if($action == …Run Code Online (Sandbox Code Playgroud) 如何修改opencart类,使其返回受影响的行数?
<?php
final class MySQL {
private $link;
public function __construct($hostname, $username, $password, $database) {
if (!$this->link = mysql_connect($hostname, $username, $password)) {
trigger_error('Error: Could not make a database link using ' . $username . '@' . $hostname);
}
if (!mysql_select_db($database, $this->link)) {
trigger_error('Error: Could not connect to database ' . $database);
}
mysql_query("SET NAMES 'utf8'", $this->link);
mysql_query("SET CHARACTER SET utf8", $this->link);
mysql_query("SET CHARACTER_SET_CONNECTION=utf8", $this->link);
mysql_query("SET SQL_MODE = ''", $this->link);
}
public function query($sql) {
if ($this->link) {
$resource …Run Code Online (Sandbox Code Playgroud) 我有一个菜单项链接列表,其中包含描述菜单的标题.这个菜单向左浮动,以减少标记我已经使标题的一部分,ul所以它很容易浮动.
例如
<ul>
<li class="heading">My Title</li>
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我应该做一些特别的事情来分开标题吗?加一个wai-aria?搜索引擎是否有可能混淆?
它本身在语义上似乎不正确.