我想Ø删除所有zip与rar文件从一个特定的目录.我已经设置了cron来运行一个名为的PHP文件cron.php,该文件位于Joomla模块目录中.出于测试目的,我将cron作业时间设置为5分钟.
我还在一个名为的目录中放了一个zip文件 test.zip
命令:
php /home/MYUSER/public_html/MYSITE/modules/mod_module_gen/cron.php
Run Code Online (Sandbox Code Playgroud)
PHP:注意:"MYSITE"是网站所在的子域
<?php
$dir = "/home/MYUSER/public_html/MYSITE/modules/mod_module_gen/package";
$files = scandir($dir);
foreach ($files as $file) {
if(preg_match("/\.(zip|rar)$/", $file)){
unlink($file);
}
}
?>
Run Code Online (Sandbox Code Playgroud)
但是,每隔5分钟,错误日志会继续抛出以下错误:
PHP Warning: unlink(test.zip) [<a href='function.unlink'>function.unlink</a>]: No such file or directory in /home/MYUSER/public_html/MYSITE/modules/mod_module_gen/cron.php on line 18
Run Code Online (Sandbox Code Playgroud)
不知道为什么这个错误发生的文件确实存在.有任何想法吗?
默认情况下是:
街道和街道号码
市
区域
邮政编码
国家
等等
但我希望能够将此订单更改为:
街道和街道号码
邮政编码
市
区域
国家
等等
我想这样做而无需安装额外的扩展.
我有一个cpanel服务器,我试图将MySQL升级到MariaDB 10,现在一切正常,除了许多使用unicode语言的Joomla 1.5网站现在显示问号而不是每个字符:
我必须澄清一些事情:在升级之前,站点正在使用MySQL 5.5正确显示,并且数据在数据库中完好无损,因此当我将站点复制到另一台MariaDB 5.6服务器时,它会正确显示.
我试过了:/etc/my.cnf.d/server.cnf
[mysqld]
collation-server=utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server=utf8
Run Code Online (Sandbox Code Playgroud)
和/etc/my.cnf.d/mysql-clients.cnf
[mysql]
default-character-set=utf8
Run Code Online (Sandbox Code Playgroud)
在joomla系统信息中,我得到:
数据库整理:N/A(mySQL <4.1.2)
没运气
我试图在数据库(mysql)中插入数据但是当我尝试使用单引号或双引号添加数据时不成功.否则工作正常(不带引号).我知道我们必须mysql_real_escape_string在这种情况下使用.但我正在使用joomla框架,这个功能不起作用.
我的代码如下:
function insert($table, $array) {
$db = JFactory::getDBO();
$query = "INSERT INTO ".$table;
$fis = array();
$vas = array();
foreach($array as $field=>$val) {
if(is_array($val)){
$x= implode(",",$val);
}
else
{
$x=$val;
}
$fis[] = "`$field`";//you must verify keys of array outside of function;
//unknown keys will cause mysql errors;
//there is also sql injection risc;
$vas[] = "'".$x."'";
}
$query .= " (".implode(", ", $fis).") VALUES (".implode(", ", $vas).")";
$db->setQuery($query);
$db->query();
}
insert('#__storage_companies',JRequest::get( 'post' ));
Run Code Online (Sandbox Code Playgroud)
请告诉我如何摆脱这个.
我有这么短的代码,只需点击一下按钮就可以将内容从一个div复制到另一个div:
<a id="btn123">CLICK ME</a>
<div id="test1"></div>
<div id="test2">
<h1>Heading</h1>
</div>
$("#btn1").click(function(){
$('#test1').html($('#test2').contents());
});
Run Code Online (Sandbox Code Playgroud)
这在http://jsfiddle.net/9hnZx/上运行正常但是当我把它放到我的网站上它将无法运行,任何人都知道为什么?谢谢
请提供步骤将Joomla 1.5组件更新为Joomla 2.5组件.
先感谢您.
一个名为"Joomla"的严重缺陷和延迟的软件给了我一般的头痛.
示例代码
我有以下代码:
<!-- .... -->
<div id="abc"><!----></div>
<script type="text/javascript">
jQuery.get(url, function(data){
jQuery('#abc').html(data);
}, 'data');
</script>
<!-- .... -->
Run Code Online (Sandbox Code Playgroud)
我从该网址获取此代码:
<!-- .... -->
<script type="text/javascript">
document.write('<span');
// perhaps write classes
document.write('>');
// and the rest of the code
</script>
<!-- .... -->
Run Code Online (Sandbox Code Playgroud)
问题
Joomla 使用snipets 是现代的document.write.这完全抹杀了任何AJAX html,除非我禁用/删除javascript,这是一个巨大的NO.
修复
我需要逐步替换文本/代码,如下所示:
<span id="ob1"><!----></span>
<script type="text/javascript">
_ob_begin(1);
_ob_write(1, '<span');
// perhaps write classes
_ob_write(1, '>');
// and the rest of the code
_ob_end(1);
</script>
Run Code Online (Sandbox Code Playgroud)
澄清
Joomla爱好者,不要接近这个话题.我觉得现在正在燃烧一个joomla dev.
生成的代码(document.write)是严格的joomla正在做...没有插件,组件或任何东西.
我有可以通过代码显示的数组:
foreach($form->data as $key => $value){
echo 'Key is '.$key.' and Value is '.$value.'<br />';
}
Run Code Online (Sandbox Code Playgroud)
我得到以下显示:
Key is language and Value is lv-LV
Key is Itemid and Value is 114
Key is option and Value is com_content
Key is pumpis_1 and Value is 1
Key is lietussargs and Value is 2
Run Code Online (Sandbox Code Playgroud)
但我只需要显示[Itemid]其中的值,在这种情况下114
我该怎么做?谢谢!Raivis