小编Pra*_*amy的帖子

如何删除url(/web/index.php)yii 2并使用带有干净url的参数设置路由?

第一个问题:我已经删除了index.php,但我/web也想删除.这是我的.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 . index.php
Run Code Online (Sandbox Code Playgroud)

这是 config/web.php

'urlManager' => [
            'class' => 'yii\web\UrlManager',
            // Disable index.php
            'showScriptName' => false,
            // Disable r= routes
            'enablePrettyUrl' => true,
            'rules' => array(
                    '<controller:\w+>/<id:\d+>' => '<controller>/view',
                    '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                    '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            ),
        ],
Run Code Online (Sandbox Code Playgroud)

它工作正常,但它仍在使用/web.可以删除/web吗?

第二个问题:

我无法使用干净的网址,我的路线设置带参数的路线 Url::toRoute(['transaction/getrequestdetail/', 'id' => 1 …

php .htaccess clean-urls yii2 yii-url-manager

4
推荐指数
1
解决办法
1万
查看次数

在 python 上为 Oauth2 设置安全 https 连接

我正在尝试使用 google people API 自动在我们的工作电话上创建一些联系人。但为了使用 people API,我需要使用 OAuth 2,并且我使用以下代码。我转到授权 URL,获取授权响应,但是当我运行令牌行时,出现错误:

InsecureTransportError: (insecure_transport) OAuth 2 MUST utilize https.
Run Code Online (Sandbox Code Playgroud)

代码如下:

import json
with open(r'C:\Users\Pedro\Desktop\client_id.json') as abb:
    ab = json.load(abb)



client_id = ab['installed']['client_id']
redirect_uri = ab['installed']['redirect_uris'][0]
client_secret = ab['installed']['client_secret']

from requests_oauthlib import OAuth2Session


scope = ['https://www.googleapis.com/auth/contacts']
oauth = OAuth2Session(client_id, redirect_uri=redirect_uri,
                          scope=scope)
authorization_url, state = oauth.authorization_url(
        'https://accounts.google.com/o/oauth2/auth',
        # access_type and prompt are Google specific extra
        # parameters.
        access_type="offline", prompt="select_account")

#authorization_response = input('Enter the full callback URL')
authorization_response = r'RESPONSE'


token = oauth.fetch_token(
        'https://accounts.google.com/o/oauth2/token',
        authorization_response=authorization_response, …
Run Code Online (Sandbox Code Playgroud)

python https oauth-2.0 python-3.x python-requests

4
推荐指数
1
解决办法
2893
查看次数

PhpStorm无法识别"<%="标记

我的php项目运行时没有错误,但PhpStorm无法识别<%= tag我预计我的PhpStorm版本是:PhpStorm 2017.2.1 Build#PS-172.3544.41,建于2017年8月2日 样本如下: PhpStorm屏幕截图

php phpstorm

2
推荐指数
1
解决办法
70
查看次数

为什么If语句为hashTable返回undefined?

有人能解释这个JavaScript的怪癖吗?

一个例子:

function func(hashTable) {
  if (hashTable['foo'])
    return true;
}

var hash = {};
hash['foo'] = 0;
func(hash);
Run Code Online (Sandbox Code Playgroud)

我得到undefined而不是true.

javascript algorithm hashtable data-structures

2
推荐指数
1
解决办法
146
查看次数

检查每次使用JavaScript提交时的互联网连接

是否有任何可能的方法来检查JavaScript中每次提交的互联网连接?

javascript jquery offline internet-connection

1
推荐指数
1
解决办法
1520
查看次数

单击网站中的任何位置时如何关闭弹出窗口

我想在用户点击正文中的任意位置时关闭弹出广告.

这是我的网站http://daplonline.in/.我想在用户点击网站的任何位置时隐藏或关闭广告.

这是弹出的HTML代码:

<div style="top: 100px; background-color: rgba(5, 5, 0, 0.7); display: block;" id="wd1_nlpopup" data-expires="30" data-delay="10">
    <div id="overlay">
        <a href="#closepopup" id="wd1_nlpopup_close">x</a>
        <div class="content">  
            <a href="buyonline.php"><img src="images/online_course.gif"/></a>
        </div>                  
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

这是JavaScript代码:

<script type="text/javascript">
    $("body").click(function(){
        alert("me");
    });
</script>
Run Code Online (Sandbox Code Playgroud)

html css jquery

0
推荐指数
1
解决办法
2万
查看次数