小编boo*_*dev的帖子

无法安装yii用户模块

我从github下载了最新版本的Yii用户模块并将其解压缩

protected/modules/
Run Code Online (Sandbox Code Playgroud)

目录所以我的目录结构包括用户和zip中包含的其他模块.我对文档中提到的主文件进行了更改,因此我的main.php现在看起来像这样

'import'=>array(
    'application.modules.user.models.*',
    'application.models.*',
    'application.components.*',

),

  'modules'=>array(
    // uncomment the following to enable the Gii tool

    'gii'=>array(
        'class'=>'system.gii.GiiModule',
        'password'=>'sheikh24',
        // If removed, Gii defaults to localhost only. Edit carefully to taste.
        'ipFilters'=>array('127.0.0.1','::1'),
    ),
            'user' => array(
                    'debug' => true,
            )

),
'components'=>array(
        'user'=>array(
            'class' => 'application.modules.user.components.YumWebUser',
            'allowAutoLogin'=>true,
            'loginUrl' => array('//user/user/login'),

        ),
    // uncomment the following to use a MySQL database

        'db'=>array(
        'connectionString' => 'mysql:host=localhost;dbname=ewindow',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => '',
        'charset' => 'utf8',
                    'tablePrefix' => …
Run Code Online (Sandbox Code Playgroud)

php yii yii-extensions

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

如果没有预加载,Yii Bootstrap不起作用

我一直在应用程序中使用Yii Bootstrap.现在,我有一个部分,在那里加载CSS文件造成的问题,我不希望加载在该控制器的引导扩展.

在我的配置文件中,我将bootstrap设置为preload:

'preload' => array('log', 'bootstrap')
Run Code Online (Sandbox Code Playgroud)

我现在已从preload数组中删除了bootstrap,它停止工作说别名不正确:

别名"bootstrap.widgets.BootNavbar"无效.确保它指向现有目录或文件.

别名虽然已在配置文件的components部分中定义,但在预加载引导程序组件时工作正常:

'bootstrap' => array(
    'class' => 'ext.bootstrap.components.Bootstrap'
 ),
Run Code Online (Sandbox Code Playgroud)

如果不预加载引导程序扩展,我该怎么办?

php yii twitter-bootstrap yii-extensions

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

从字符串中删除字母

我有像'12454v','346346z'这样的字符串.我想删除字符串中的所有字母.

重新工作正常:

import re
str='12454v'
re.sub('[^0-9]','', str)

#return '12454'
Run Code Online (Sandbox Code Playgroud)

有没有办法在不使用正则表达式的情况下执行此操作?

python

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

按钮setonclicklistener错误

我现在遇到问题setOnClickListener.

当我把这个以下行:

button.setOnClickListener(this);
Run Code Online (Sandbox Code Playgroud)

然后运行应用程序然后它不运行并显示"应用程序强制关闭"的消息.

你能帮我解决一下如何在Android 2.2中设置按钮onclick事件吗?

events android onclick button

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

php安全输出

我正试图制作一个"记住字段"的东西,所以如果有一个错误,你将不必再填写整个表格.但是如何才能使输出安全?

例:

<input type="text" name="email" value="<?php echo (isset($_POST['email'])) ? htmlspecialchars($_POST['email']) : ''; ?>" />
Run Code Online (Sandbox Code Playgroud)

如果有人输入"'"(没有引号),例如你得到:

Warning: mysql_result() expects parameter 1 to be resource, boolean given in C:\wamp\www\pages\register.php on line 55
Run Code Online (Sandbox Code Playgroud)

那么我试过:

<input type="text" name="email" value="<?php echo (isset($_POST['email'])) ? mysql_real_escape_string($_POST['email']) : ''; ?>" />
Run Code Online (Sandbox Code Playgroud)

然后它只是增加了很多//////.

我该怎么办?

我是noob是的.但我认为htmlspecialchars使用户输入安全吗?

php

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

通过多种条件查找所有

我有4张桌子:

  • 内容
  • 关系
  • 学科

内容:

id(int)
title(varchar)
text(text)
Run Code Online (Sandbox Code Playgroud)

学科:

id(int)
title(varchar)
prent_id(int)
Run Code Online (Sandbox Code Playgroud)

组:

id(int)
title(varchar)
Run Code Online (Sandbox Code Playgroud)

关系:

id(int)
content_id(int)
group_id(int)
subject_id(int)
Run Code Online (Sandbox Code Playgroud)

关系的内容多对多.

群体内容多对多的.

的内容多对多.

内容可能属于多个主题或几个组.

我想执行一个像这样的查询:

select * from relation where group_id = 1,3 and subject_id = 1,4,6,7
Run Code Online (Sandbox Code Playgroud)

yii

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

如何将自动增量主键附加到同一个表中的另一个字段?

我正在为mysql使用yii活动记录,并且我有一个表,其中有一个字段需要附加同一个表的主键.主键是自动增量字段,因此在保存之前我无法访问主键.

$model->append_field = "xyz".$model->id; // nothing is appending
$model->save();
$model->append_field = "xyz".$model->id; //id is now available
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?
我知道我可以在插入后立即更新,但有更好的方法吗?

mysql auto-increment yii

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

Yii - CGridView - 添加自己的属性

$this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider'=>$dataProvider,
    'columns'=>array(
        'title',          // display the 'title' attribute
        'category.name',  // display the 'name' attribute of the 'category' relation
        'content:html',   // display the 'content' attribute as purified HTML
        array(            // display 'create_time' using an expression
            'name'=>'create_time',
            'value'=>'date("M j, Y", $data->create_time)',
        ),
        array(            // display 'author.username' using an expression
            'name'=>'authorName',
            'value'=>'$data->author->username',
//HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
              'htmlOptions'=>array('class'=>'$data->author->username', 'secondAttribute' => $data->author->id),
//HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        ),
        array(            // display a column with "view", "update" and "delete" buttons
            'class'=>'CButtonColumn',
        ),
    ),
));
Run Code Online (Sandbox Code Playgroud)

在选项中value我可以从PHP添加变量,但是对于选项,htmlOptions这是不可能的.为什么?
如何使用PHP变量创建属性?

php yii

5
推荐指数
2
解决办法
8500
查看次数

什么`key_prefix`为flask-cache做什么?

比如这样,是否有必要使用key_prefix

@cache.cached(timeout=50, key_prefix='all_comments')
def get_all_comments():
    comments = do_serious_dbio()
    return [x.author for x in comments]

cached_comments = get_all_comments()
Run Code Online (Sandbox Code Playgroud)

文档中,它表示key_prefix默认值是request.path cache_key.:什么cache_key意思,我该如何使用它?怎么key_prefix办?

python caching flask flask-extensions

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

无法将实体导入数据存储模拟器

我正在尝试将数据存储实体的备份恢复到在本地主机上运行的模拟器中。

我正在使用此位置的指南https://cloud.google.com/datastore/docs/tools/emulator-export-import 这是我迄今为止所做的。

#start the emulator
gcloud beta emulators datastore start --store-on-disk --data-dir "./datastore-emulator" --project=my-project
Run Code Online (Sandbox Code Playgroud)
# set the environment
$(gcloud beta emulators datastore env-init)

# initiate the restore operation
curl -X POST localhost:8081/v1/projects/my-project:import \
-H 'Content-Type: application/json' \
-d '{"input_url":"/home/bogdan/workspace/myCopy/2019-08-19-23-00/2019-08-19-23-00.overall_export_metadata"}'
Run Code Online (Sandbox Code Playgroud)

此时我可以看到模拟器检测到连接,这是日志片段

[datastore] Dev App Server is now running.
[datastore] 
[datastore] The previous line was printed for backwards compatibility only.
[datastore] If your tests rely on it to confirm emulator startup,
[datastore] please migrate to the emulator health check endpoint …
Run Code Online (Sandbox Code Playgroud)

emulation google-cloud-datastore google-cloud-platform

5
推荐指数
0
解决办法
804
查看次数