RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-176063

des1roer's questions

Martin Hope
des1roer
Asked: 2023-02-14 12:32:13 +0000 UTC

php rabbitmq监听器向浏览器发送回显

  • 5
    public function actionCallback(): void
    {
        $this->setHeaders();

        self::listener();
    }

    private function setHeaders(): void
    {
        set_time_limit(0);
        header('Content-Type: text/event-stream');
        header('Connection: keep-alive');
        header('Cache-Control: no-store');
        echo 'retry: 10000' . PHP_EOL;
    }

    public static function listener($timeout = 0): void
    {
        try {
            $context = self::getAmqpConnection();
            $queue = $context->createQueue('queue');

            $subscriptionConsumer = $context->createSubscriptionConsumer();
            $subscriptionConsumer->subscribe(
                $context->createConsumer($queue),
                function (PsrMessage $message, PsrConsumer $consumer) {
                    try {
                        $msg = json_decode($message->getBody());
                        // сюда заходит
                        $id = time();
                        $msg = json_encode($msg, JSON_THROW_ON_ERROR);
                        self::sendMsg($id, $msg);

                        $consumer->acknowledge($message);
                    } catch (\Throwable $e) {
                    }
                }
            );
            $subscriptionConsumer->consume($timeout);
        } catch (\Throwable $e) {
        }
    }

    private static function sendMsg(string $id, string $msg): void
    {
        echo "data: $msg" . PHP_EOL;
        echo "id: $id" . PHP_EOL;
        echo PHP_EOL;
        ob_flush();
        flush();
    }

我想在 php 中实现服务器发送的事件 - https://bigboxcode.com/php-server-sent-events-sse

但是当你启动队列监听器时,它只是在一个无限循环中并且没有返回结果

是否可以从闭包订阅输出回声?

在此处输入图像描述

php
  • 1 个回答
  • 11 Views
Martin Hope
des1roer
Asked: 2022-04-19 13:18:36 +0000 UTC

如何将\放在PHP中所有函数的前面?

  • 0

在项目中,为了统一起见,决定在函数前使用斜线,即 \array_filter、\in_array

https://github.com/symplify/easy-coding-standard和 symfony使用

php
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2022-08-18 15:46:09 +0000 UTC

Postgres 在元组中发现多个 id

  • 0

有两张桌子。哈希是唯一的。id - 增量

+----------+
| id hash  |
+----------+
| 1  asd   |
| 2  ddd   |
+----------+

+-----------+
| id2 hash2 |
+-----------+
| 1  33     |
| 2  3444   |
| 3  asd    |
| 4  ddd    |
| 5  34234  |
+-----------+

我如何在 (1,2) 中找到 id2 以用于散列 in(asd, ddd) ?

那些。您需要查找是否有从第一个表到第二个表的条目以及该条目的结束位置

好吧,对于(5)中的数据 id2,您还需要找到

sql
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-02-13 14:39:12 +0000 UTC

Easy Admin 指定字段唯一性

  • 1

这里https://github.com/EasyCorp/EasyAdminBundle/issues/1923 表示可以使用什么

EasyCorp\Bundle\EasyAdminBundle\Mapping\Annotation

但我没有那个课。

"easycorp/easyadmin-bundle": "^2.1",

php
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-02-03 18:00:58 +0000 UTC

通过 Symfony 中的回调进行验证

  • 0

如何在注释中正确指定自定义验证函数。码头的选项不起作用

/**
 * @GQL\Field(type="String")
 * @Assert\Callback("validate")
 * @GQL\Description(value="template Image")
 *
 * @var string
 */
public $templateId;

public static function validate($object, ExecutionContextInterface $context, $payload)
{
   dd($object);
}
php
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-11-22 16:30:09 +0000 UTC

Symfony Overblog 使用上下文

  • 0

在 graphql 规范中有一个上下文的概念

是否可以从客户端传输它然后在解析器中使用它

谈论https://github.com/overblog/GraphQLBundle

symfony
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-10-31 21:25:04 +0000 UTC

Symfony 4如何加入?

  • 0

错误

In QueryException.php line 54:

  [Syntax Error] line 0, col 147: Error: Expected end of string, got 'ON'  


In QueryException.php line 43:

  SELECT eventListingImage FROM App\Entity\EventListingImage eventListingImage LEFT JOIN eventListingImage.newEventListingImage newEventListingImage ON newEventListingImage.eventListing = eventListingImage.eventListing WHERE newEventListingImage.eventListingImag  
  e IS NULL      

要求

        $c = $this->eventListingImageRepository->createQueryBuilder('eventListingImage')
            ->select('eventListingImage')
            ->leftJoin(
                'eventListingImage.newEventListingImage',
                'newEventListingImage',
                Join::ON,
                'newEventListingImage.eventListing = eventListingImage.eventListing'
            )
            ->andWhere('newEventListingImage.eventListingImage IS NULL')
            ->getQuery()
            ->getResult();

在 \App\Entity\NewEventListingImage::$eventListingImage

    /**
     * @ORM\OneToOne(targetEntity="App\Entity\EventListingImage", mappedBy="newEventListingImage")
     *
     * @var EventListingImage|null
     */
    private $eventListingImage;

在 \App\Entity\EventListingImage::$newEventListingImage

    /**
     * @ORM\OneToOne(targetEntity="App\Entity\NewEventListingImage", inversedBy="eventListingImage")
     * @JoinColumn(name="event_listing_id", referencedColumnName="event_listing_id")
     *
     * @var EventListing|null
     */
    private $newEventListingImage;

我想收到一个请求

select event_listing_image.*
from event_listing_image
         left join image i on event_listing_image.event_listing_id = i.event_listing_id
where i.id is null

如果使用

   ->leftJoin(
                'eventListingImage.newEventListingImage',
                'newEventListingImage'
            )

然后一个错误

In QueryException.php line 215:

  A single-valued association path expression to an inverse side is not supported in DQL queries. Instead of "newEventListingImage.eventListingImage" use an explicit join.  


php
  • 2 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-04-07 15:07:46 +0000 UTC

来自链接表的 Yii2 数据

  • 0

在此处输入图像描述

如何在最终模型(item)中从连接模型(pesrItem.cnt)中获取数据

yii2
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-01-12 20:57:18 +0000 UTC

PHP将有符号整数转换为无符号?

  • 0

如何将负值转换为无符号?

-1000 = ?

php
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-09-30 15:49:44 +0000 UTC

Postgres 排序时不存在。

  • 0

如何使 postgre 排序以使数字不在 N 之后?

在此处输入图像描述

编号被识别为否

我需要把#和#放在一起

第 9.6 页

postgresql
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-09-04 14:46:46 +0000 UTC

Yii2 - 数据更改验证器

  • 2

以及如何制作验证器以防止数据更改?api相关

yii2
  • 2 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-07-29 21:44:04 +0000 UTC

不允许使用 Yii2 Rest 方法

  • 0

https://github.com/des1roer/yii2test

在此处输入图像描述

配置https://github.com/des1roer/yii2test/blob/master/config/web.php

api 本身https://github.com/des1roer/yii2test/tree/master/modules/api

怎么修?

yii2
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-07-26 20:27:27 +0000 UTC

您通过社交网络授权?

  • 1

通过具有自己细微差别的社交网络授权用户的最佳做法是什么?

情况是这样的 - 注册时,您必须指定您的电子邮件和电话号码。

社交网络返回电子邮件和姓名。

这还不够授权,但又不想失去。并且明确地转移,似乎不是很专业。怎样成为?

在 yii2 上实现。

yii2
  • 2 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-06-04 01:23:10 +0000 UTC

Vue js 常量覆盖

  • 1
const default_row = {
    series: 1,
    season: 1
};

var vm = new Vue({
    el: '.wrapper',
    data: {
        cols: {},
        id: window.location.href.split('#')[1] || 0,
        loader: true,
        showModal: false,
        add_row: default_row,
        rows: {},
        col_names: []
    },
    mounted: function () {
//        next(self.videos, self.id)
    },
    methods: {
        add: function (data) {
            var self = this;
            if (Object.size(self.add_row) != 4) {
                alert('НЕ ВСЕ ПОЛЯ ЗАПОЛНЕНЫ');
                c('НЕ ВСЕ ПОЛЯ ЗАПОЛНЕНЫ', moment().format("YYYY-MM-DD HH:mm:ss"));
                validInput();
                return false;
            }
            inValid();
            self.loader = true;
            $.ajax({
                url: "php/data.php",
                type: 'POST',
                data: {act: 'add', data: self.add_row, user: self.user_id},
                success: function (data) {
                    var data = JSON.parse(data);
                    if (typeof data.error == 'undefined') {
                        self.add_row = default_row;
                        c(default_row) //здесь косяк
                        vm.refresh();
                    } else {
                        alert(data.error.errorInfo);
                    }
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });
        },
})

我希望应用默认值,并且在这个阶段我输入的数据

那些。有一个输入表单,在发送到服务器后你需要把它恢复到原来的形式,但是常量已经不知何故改变了

javascript
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-06-03 14:29:21 +0000 UTC

JSON.parse 转换数据?

  • 0
$.ajax({
            url: "php/data.php",
            type: 'POST',
            data: {act: 'load', user: self.user_id},
            success: function (data) {  
                c(data)
                var data = JSON.parse(data);
                c(data)
                self.loader = false;
                self.cols = data;
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert(errorThrown);
            }
        });

得到

[{"cn":"serial","dt":"varchar","c":""},{"cn":"series","dt":"int","c":""},{"cn":"season","dt":"int","c":""},{"cn":"url","dt":"varchar","c":""}]
    admin.js?1.0:2 
    (4) [Object, Object, Object, Object]
    0:Object
    c
    cn:"serial"
    dt:"int"

那些。varchar不知何故变成了int

js https://gist.github.com/des1roer/2f670631f9a60bbb3ada02a7adfe3742

PHP https://gist.github.com/des1roer/9ea8067b3d0f6999d3a31b3d47067dcb

javascript
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-05-15 18:25:12 +0000 UTC

css 块站点和显示加载

  • 2

如何冻结页面

好吧,这样就不可能做任何事情并在中心显示加载程序

html
  • 2 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-03-16 00:44:23 +0000 UTC

Vue js 循环使用组件

  • 0

试图创建一个组件

<head>
  <meta charset="utf-8">
  <title>vue</title>
</head>

<body>
  <div class="container" style="margin-top: 20px" id="app">
    <child message="hello!"></child>
    <table class='table table-bordered'>

      <tbody>
        <user :users="users"></user>
      </tbody>
    </table>

  </div>
</body>

</html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.1/vue.min.js" type="text/javascript"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
  crossorigin="anonymous">
<script type="text/javascript">
  Vue.component('user', {
    // declare the props
    props: ['users'],
    // just like data, the prop can be used inside templates
    // and is also made available in the vm as this.message
    template: `        
        <tr v-for="user in users">
          <td @click="selectResponder(user)"> {{user.name}} </td>
          <td> {{user.con_position}} </td>
          <td> {{user.telephone}} </td>
          <td> {{user.email_to}} </td>
          <td> {{user.mobile}} </td>
        </tr>`
  })

  new Vue({
    el: '#app',
    data: {
      users:
      [{ name: 1, con_position: 2, telephone: 33, email_to: 44, mobile: 555 },
      { name: 2342, con_position: 34534, telephone: 3453453, email_to: 345345, mobile: 34345345 },]
    },
    methods: {
      selectResponder(user) {
        //either...

        user.name = 4324
        console.log(user)
      }
    }
  })

</script>

但什么也没有出来。控制台没有错误

http://codepen.io/des1roer/pen/aJLpog

vue.js
  • 2 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-03-12 23:39:08 +0000 UTC

Vue js 2 如何在select中显示选中的属性

  • 0

有这样一段代码

    <div id="watch-example">
        <select v-model="selected">
          <option v-for="option in options" :value="option.value">
            {{ option.text }}
          </option>
        </select>
        <span>Выбрано: {{ selected }}</span>
    </div>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.1/vue.min.js"></script>
    <script>
    var watchExampleVM = new Vue({
      el: '#watch-example',
      data: {
        selected: 'A',
        options: [
          { text: 'One', value: 'A' },
          { text: 'Two', value: 'B' },
          { text: 'Three', value: 'C' }
        ]
      }
    })

http://codepen.io/des1roer/pen/gmWZgO

但是如果我想显示选中的文本(一、二、三)怎么办?

代码本身来自

http://en.vuejs.org/v2/guide/forms.html#Dropdowns

javascript
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-02-18 14:38:18 +0000 UTC

Ruby ob Rails rake 中止

  • -1
    > rake db:migrate --trace
    rake aborted!
    NameError: undefined local variable or method `__dir__' for main:Object
    F:/OpenServer/domains/localhost/webrails/config/boot.rb:1:in `<top (required)>' F:/OpenServer/domains/localhost/webrails/config/application.rb:1:in `require_relative'
    F:/OpenServer/domains/localhost/webrails/config/application.rb:1:in `<top (required)>'
    F:/OpenServer/domains/localhost/webrails/Rakefile:4:in `require_relative'
    F:/OpenServer/domains/localhost/webrails/Rakefile:4:in `<top (required)>'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/rake_module.rb:28:in `load'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/rake_module.rb:28:in `load_rakefile'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/application.rb:687:in `raw_load_rakefile'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/application.rb:96:in `block in load_rakefile'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/application.rb:95:in `load_rakefile'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/application.rb:79:in `block in run'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
    C:/Ruby19/lib/ruby/gems/1.9.1/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'

    C:/Ruby19/bin/rake:23:in `load'
    C:/Ruby19/bin/rake:23:in `<main>'

我使用 openserver 和 win10

轨道 -v 轨道 5.0.1

宝石-v 1.8.24

耙耙中止!

windows
  • 1 个回答
  • 10 Views
Martin Hope
des1roer
Asked: 2020-01-18 21:14:33 +0000 UTC

NuSoap 在函数中使用变量

  • 0

服务器

$server->wsdl->addComplexType(
    'complexReturn', 'complexType', 'struct', 'all', '',
    array(
    'id' => array('name' => 'id', 'type' => 'xsd:string'),
    'param' => array('name' => 'param', 'type' => 'xsd:string')
    )
);

$server->register('get', array('id' => 'xsd:string', 'param' => 'xsd:string'), //parameters
    array('return' => 'tns:complexReturn'), //output
    'urn:server', //namespace
    'urn:server#getServer', //soapaction
    'rpc', // style
    'encoded', // use
    'description');  //description

function get($id, $param)
{
  return array(
      'id' => $id,
      'param' => $param
  );
}

客户

$client = new SoapClient("http://inner_work/test/nusoap/samples/server.php?wsdl",
      array(
      "trace" => 1,
      "exceptions" => 1,
      "cache_wsdl" => 0,
      "encoding" => "UTF-8",
      'soap_version' => SOAP_1_1,
      'style' => SOAP_DOCUMENT,
      'use' => SOAP_LITERAL,
      ));

  var_dump($client->get(array('id'=>'john', 'param'=>'doe')));

输出对象(stdClass)#2 (2) { ["id"]=> string(5) "Array" ["param"]=> NULL }

如何在 get 函数中使用接收到的变量?

php
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5