如何显示和计算昨天的日期值?我曾经time()
在数据库中插入日期.例:
URL: google.com youtube.com google.com youtube.com test.com youtube.com
DateVisited: 1313668492 1313668540 1313668571 13154314
Run Code Online (Sandbox Code Playgroud)
我想要显示表中存在多个URL的URL以及昨天访问过多少个URL.示例结果:
LINK | timesExisted | timesVisitedYesterday
Google.com | 2 | 2
youtube.com| 3 | 3
Run Code Online (Sandbox Code Playgroud)
我已经有了关于获取昨天日期的想法,但我不知道如何计算昨天URL存在的次数并计算表中存在的URL的次数.
我有这样的csv值:
$csv_data = "test,this,thing
hi,there,this
is,cool,dude
have,fun";
Run Code Online (Sandbox Code Playgroud)
我想取一个完整的CSV字符串并将其读入一个多维数组,以便我得到:
array(
array(
'test' => 'hi',
'this' => 'there',
'thing' => 'this'
),
array(
'test' => 'is',
'this' => 'cool',
'thing' => 'dude'
),
array(
'test' => 'have',
'this' => 'fun',
'thing' => ''
)
);
Run Code Online (Sandbox Code Playgroud)
我想要这样的输出,请注意CSV值是动态的.
我注意到,当我键入时,sudo crontab -e
我没有看到我的cron命令,但是当我这样做时,只有crontab -e
我的命令.
2之间有区别吗?如果有,我应该把我的cron命令放在哪里,它应该在sudo中还是没有sudo?
谢谢!
我的应用程序上有这个非常奇怪的错误.每次我打开我的应用我认为完美的作品,但是当我试图把我的应用程序在后台,然后再次打开我的应用程序,我的看法回收重新调整.
这是一张正确描述它的图片:
这是正确的图像:
当应用程序在后台时,这是弄乱我的recyclerview的图像,然后我再次打开它.
有时我的recyclerview中的所有图像都消失了.这是一个截图:
这是我的onResume()
代码:
public void onResume()
{
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
if (fragment instanceof MenuFragment)
{
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.remove(fragment);
transaction.commit();
transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragment_container, fragment);
transaction.addToBackStack(null);
transaction.commit();
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的查看分页器布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/app_background">
<android.support.constraint.ConstraintLayout
android:id="@+id/action_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<include
android:id="@+id/nav_bar"
layout="@layout/home_screen_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<com.yotadevices.widget.RtlViewPager
android:id="@+id/menuFragment_viewPager"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@android:color/transparent"
app:layout_constraintBottom_toTopOf="@+id/buttons"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/nav_bar"/>
<include
android:id="@+id/buttons"
layout="@layout/navigation_layout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" …
Run Code Online (Sandbox Code Playgroud) xml android android-layout android-fragments android-recyclerview
我想在CentOs上安装git,我正在运行这个命令
yum install git-core
Run Code Online (Sandbox Code Playgroud)
但问题是,我收到这些错误:
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
* epel: mirrors.solfo.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package git.x86_64 0:1.7.1-3.el6_4.1 will be installed
--> Processing Dependency: perl-Git = 1.7.1-3.el6_4.1 for package: git-1.7.1-3.e
l6_4.1.x86_64
--> Processing Dependency: perl(Git) for package: git-1.7.1-3.el6_4.1.x86_64
--> Processing Dependency: perl(Error) for package: git-1.7.1-3.el6_4.1.x86_64
--> Finished Dependency Resolution
Error: Package: git-1.7.1-3.el6_4.1.x86_64 (updates)
Requires: perl-Git = 1.7.1-3.el6_4.1
Error: Package: git-1.7.1-3.el6_4.1.x86_64 (updates)
Requires: perl(Error)
Error: Package: git-1.7.1-3.el6_4.1.x86_64 …
Run Code Online (Sandbox Code Playgroud) 我在一个子目录上部署了yii2.我在重定向上遇到问题.在我的localhost上,我的项目不在子目录中,所以我没有任何问题.但是当我将它部署在我们的实时服务器上并将项目放在子目录中时,我遇到了问题.
我的问题是,当我访问我网站的主页时,我被重定向到网站的根目录.
以下是一个示例:主站点:http://example.com/
Yii2网站:http://example.com/myproject/
当我尝试访问http://example.com/myproject/时,我希望在http://example.com/myproject/login上重定向,而不是重定向到http://example.com/login.
我已经将我的.htaccess改成了这个
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule ^(.*) system/index.php/$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)
但我认为这个错误虽然......
我的web.php上也有这个
$config = [
'id' => 'basic',
'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
'defaultRoute' => 'site/login',
//... other codes here...
Run Code Online (Sandbox Code Playgroud)
正如你可以看到我有一个defaultRoute
是site/login
但似乎我一直在重定向的/login
,这是不是在一个子文件夹的链接.
任何帮助如何在子目录中设置yii2
对你的帮助表示感谢.谢谢!
我下载了一个使用这个php函数http_build_url()的API.我每次运行我的应用程序时都说:
Fatal error: Call to undefined function http_build_url()
Run Code Online (Sandbox Code Playgroud)
我做了一个研究,发现我应该安装pecl_http来运行该功能.现在,我将它安装到我的系统中,顺便说一句,我使用的是Windows XP.我通过CMD通过goint将这个安装到我的xampp/php文件夹并运行此命令:
pecl install pecl_http
Run Code Online (Sandbox Code Playgroud)
不幸的是,我无法安装这个,因为它说:
ERROR: The DSP pecl_http.dsp does not exist.
Run Code Online (Sandbox Code Playgroud)
这个是否有解决方法?或任何我想让http_build_url()运行的想法.
我有这段代码,但收到此错误 - “无法在异步函数之外使用关键字 'await'”:
async login() {
try {
this.$validator.validateAll().then((result) => {
if (result) {
this.state = 'LOADING';
this.response = [];
const authResponse = await axios.post('/api/auth/login', this.user);
const auth = authResponse.data;
if (auth.success) {
this.$authLoggedIn(auth);
this.$authRedirectToDefault();
} else {
this.response.push(auth.error);
this.state = 'ERROR';
}
}
});
} catch (error) {
this.state = 'ERROR';
this.response.push(error);
}
},
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?被困在这个问题上几个小时了。
谢谢。
可能重复:
用于php的"::"表示法是什么?
我在修改好友代码时发现了这段代码并注意到了这段代码:TestPages :: LoadMenu();
什么::在php中意味着什么?
一个好的答案意味着很多.
谢谢!
我有一个名为的表ad_view
,它在该表中有1890万个数据.
这是表的设计 ad_vew
ad_view
-------
ad_id
network_id
publisher_id
landingpage_id
advertiser_id
Run Code Online (Sandbox Code Playgroud)
我正在使用此查询来获取ad_id
和ad_id
依赖的计数network_id
,所以在这种情况下network_id
是4
.
select ad_id,count(ad_id) as strength
from ad_view
where network_id = 4
group by ad_id
order by strength desc
limit 10
Run Code Online (Sandbox Code Playgroud)
此查询需要永远加载.您有什么建议如何快速进行此查询?
我不是数据库专家,如果需要重新设计这个表,我会这样做.
任何建议将不胜感激,谢谢!