我有jQuery加载很好,我已经四重检查,虽然我在FireBug中收到此错误"$不是一个函数",我的代码不起作用.
这是我的代码:
<script type="text/javascript">
$("ol li:nth-child(1)").addClass('olli1');
$("ol li:nth-child(2)").addClass("olli2");
$("ol li:nth-child(3)").addClass("olli3");
$("ol li:nth-child(4)").addClass("olli4");
$("ol li:nth-child(5)").addClass("olli5");
$("ol li:nth-child(6)").addClass("olli6");
$("ol li:nth-child(7)").addClass("olli7");
$("ol li:nth-child(8)").addClass("olli8");
$("ol li:nth-child(9)").addClass("olli9");
$("ol li:nth-child(10)").addClass("olli10");
$("ol li:nth-child(11)").addClass("olli11");
$("ol li:nth-child(12)").addClass("olli12");
$("ol li:nth-child(13)").addClass("olli13");
$("ol li:nth-child(14)").addClass("olli14");
$("ol li:nth-child(15)").addClass("olli15");
$("ol li:nth-child(16)").addClass("olli16");
$("ol li:nth-child(17)").addClass("olli17");
$("ol li:nth-child(18)").addClass("olli18");
$("ol li:nth-child(19)").addClass("olli19");
$("ol li:nth-child(20)").addClass("olli20");
</script>
Run Code Online (Sandbox Code Playgroud) 我正在尝试将文件从一个位置复制到另一个位置.我很确定位置是正确的,但我仍然在标题中收到错误.
这是一些代码:
$oDirectory = new \RecursiveDirectoryIterator($extractFolder.'/res');
$oIterator = new \RecursiveIteratorIterator($oDirectory);
foreach($oIterator as $oFile) {
if ($oFile->getFilename() == 'icon.png') {
$icons[filesize($oFile->getPath().'/icon.png')] = $oFile->getPath().'/icon.png';
}
}
asort($icons);
print_r($icons);
$icon_source = end($icons);
echo $icon_source;
$generated_icon_file = str_slug($packagename.$version).'.png';
Storage::copy($icon_source, $generated_icon_file);
Run Code Online (Sandbox Code Playgroud)
的print_r
(这意味着这些文件存在)返回:
Array ( [19950] => /var/www/apk.land/storage/extracted_apks/res/drawable-xxhdpi-v4/icon.png [31791] => /var/www/apk.land/storage/extracted_apks/res/drawable-xxxhdpi-v4/icon.png [6979] => /var/www/apk.land/storage/extracted_apks/res/drawable-hdpi-v4/icon.png [10954] => /var/www/apk.land/storage/extracted_apks/res/drawable-xhdpi-v4/icon.png )
Run Code Online (Sandbox Code Playgroud)
回声返回:
/var/www/apk.land/storage/extracted_apks/res/drawable-xxxhdpi-v4/icon.png
Run Code Online (Sandbox Code Playgroud)
而确切的错误是:
在路径找不到文件:var/www/apk.land/storage/extracted_apks/res/drawable-xxxhdpi-v4/icon.png
PS PHP的copy
功能非常棒.
我在这里找不到问题.
有什么建议?
我正在尝试做这样的事情:
function doSomething($param, Class) {
Class::someFunction();
}
$someVar = doSomething($param, Class);
Run Code Online (Sandbox Code Playgroud)
可能吗?
更好地解释我正在尝试做什么.我在Laravel中有一个辅助函数来生成独特的slug,因此我必须根据slug的保存位置查询不同的表.
我想写的实际代码:
$newcat->slug = $helper->uniqueSlug($appname, Apk);
public function uniqueSlug($str, Apk)
{
$slug = Str::slug($str);
$count = Apk::whereRaw("slug RLIKE '^{$slug}(-[0-9]+)?$'")->count();
return $count ? "{$slug}-{$count}" : $slug;
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
当我点击我网站上的链接时,我想隐藏推荐人.要更好地了解我想要做什么:当有人点击我网站上的链接时,我不希望其他网站所有者知道访问者来自哪里.
我不在乎它是由PHP,HTML还是Javascript完成的.
我试过HTML刷新,javascript window.location,javascript弹出,PHP标题重定向,但没有任何效果.
我正在尝试制作一个固定位置的侧边栏,它下面有一个小标题和一个可滚动的 div。
我的问题是我无法滚动整个 div,所以我看不到其中的所有内容。
这是我的代码,它在 jsfiddle 上。
HTML
<section>
<header>we have some text here
<br>a few lines
<br>doesn't matter
<br>
</header>
<div class="scroll-box">FIRST LINE
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't matter
<br>we have some text here
<br>a few lines
<br>doesn't …
Run Code Online (Sandbox Code Playgroud) 我安装了nginx,php,php-fpm,php-pecl-redis.所有这些都有效,但最后一个有效.
当我跑步时/usr/sbin/php-fpm
,我得到了这个:
PHP警告:PHP启动:无法加载动态库'/usr/lib/php/modules/redis.so' - /usr/lib/php/modules/redis.so:未定义符号:第0行未知的igbinary_unserialize
我不知道"igbnary_unserialize"是什么意思以及如何解决它.
我检查了正确路径下的redis.so文件.我添加extension=redis.so
到"php.ini"
php版本:5.3.3 phpredis版本:2.2.7
我正在浏览Laravel的源代码,我发现了很多针对Eloquent的SQL运算符,我想知道它们中的一些是什么以及如何使用它们.
遗憾的是,我没有设法找到任何文档.
这是我发现的运营商vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php
:
protected $operators = [
'=', '<', '>', '<=', '>=', '<>', '!=',
'like', 'like binary', 'not like', 'between', 'ilike',
'&', '|', '^', '<<', '>>',
'rlike', 'regexp', 'not regexp',
'~', '~*', '!~', '!~*', 'similar to',
'not similar to',
];
Run Code Online (Sandbox Code Playgroud)
还有一堆我不明白的.例如:&
,|
,^
,<<
,>>
,~
,~*
,!~
,!~*
.
谁能告诉我一个如何使用它们的例子?
谢谢
我一直在尝试发送信标 beforeunload
,它似乎适用于几乎所有现代浏览器,除了处于隐身模式的 Chrome。
这是适用于所有现代浏览器的代码,除了处于隐身模式的 Chrome:
window.onbeforeunload = function() {
navigator.sendBeacon("url");
}
Run Code Online (Sandbox Code Playgroud)
甚至这段代码似乎都不起作用:
window.onbeforeunload = function() {
console.log('before unload')
}
Run Code Online (Sandbox Code Playgroud)
我做错了什么还是只是 Chrome 的错?
我在删除目录时遇到问题。
我正在创建一个临时目录,在其中解压缩文件,并在完成后将其删除。
我的代码看起来很像这样:
$tempPath = storage_path('temp/'.$filemd5.'/');
Storage::makeDirectory($tempPath);
$success = Storage::deleteDirectory($tempPath);
return $success;
Run Code Online (Sandbox Code Playgroud)
它不返回任何内容,目录也不会被删除。