小编b4r*_*3kk的帖子

GROUP BY但从其他列获取所有值

我会在示例中解释我需要做什么.首先,我们有一个像这样的简单表,名为table:

id | name
===+=====
1  | foo
1  | bar
1  | foobar
2  | foo
2  | bar
2  | foobar
Run Code Online (Sandbox Code Playgroud)

现在查询:

SELECT t.* FROM table t GROUP BY t.id
Run Code Online (Sandbox Code Playgroud)

会得到类似于这个的结果:

id | name
===+=====
1  | foo
2  | foo
Run Code Online (Sandbox Code Playgroud)

但是有可能收集所有名称的值来得到这样的结果吗?

id | name
===+=================
1  | foo, bar, foobar
2  | foo, bar, foobar
Run Code Online (Sandbox Code Playgroud)

sql group-by

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

我的ssl证书不受信任

我使用此命令在我的服务器上制作了证书:

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
Run Code Online (Sandbox Code Playgroud)

并且正确配置了所有内容,因为除了http之外输入https时我的网站是可用的.但是有一个问题.我的证书不受信任.

Firefox提示:

sec_error_untrusted_issuer
Run Code Online (Sandbox Code Playgroud)

和Chrome:

NET::ERR_CERT_AUTHORITY_INVALID
Run Code Online (Sandbox Code Playgroud)

有没有办法让我的证书值得信赖?那么错误不会发生?

因为我可以接受风险并转发到网站,但对于通过https访问我的网站的人来说这看起来不太好.

linux apache openssl

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

PostgreSQL shared_buffers的单位是什么?

我想改变mu pgsql数据库配置,我想知道他们用什么单位来描述一些值.大多数情况下,我想了解shared_buffers.

如果我的shared_buffers值是例如16384,那它是KB吗?MB?字节?这个值的单位是多少?

postgresql

4
推荐指数
3
解决办法
3601
查看次数

ZF2 - 如何正确设置标题?

我在ZF2中设置标题有问题.我的代码看起来像这样:

public function xmlAction()
{
    $headers = new \Zend\Http\Headers();
    $headers->clearHeaders();
    $headers->addHeaderLine('Content-type', 'application/xml');

    echo $file; // xml file content
    exit;
}
Run Code Online (Sandbox Code Playgroud)

但标题仍然是text/html.我可以设置正确的标题:

header("Content-type: application/xml");
Run Code Online (Sandbox Code Playgroud)

但我想用Zend Framework做到这一点.为什么上面的代码不起作用?

php http-headers zend-framework2

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

spl_autoload_register - 如何防止致命错误

我有以下函数来加载我的库:

function load_class($name) {
    $namePath = explode('_', $name);
    $filePath = '';
    if (is_array($namePath)) {
        for ($i=0; $i<sizeof($namePath); $i++) {
            $filePath .= $namePath[$i];
            if ($i != sizeof($namePath) - 1) $filePath .= '/';
        }
    } else $filePath = $name;
    if (is_file($filePath . '.php')) require_once($filePath . '.php'); 
    else if (is_file($filePath . '.class.php')) require_once($filePath . '.class.php');
    else throw new Exception('Unable to load class: ' . $name . '. No such file or a directory. ');
    if (!class_exists($name)) throw new Exception('Class: ' . $name . …
Run Code Online (Sandbox Code Playgroud)

php oop class

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

标签 统计

php ×2

apache ×1

class ×1

group-by ×1

http-headers ×1

linux ×1

oop ×1

openssl ×1

postgresql ×1

sql ×1

zend-framework2 ×1