Git Product home page Git Product logo

Comments (2)

leeyisoft avatar leeyisoft commented on June 9, 2024

同问:

require "vendor/autoload.php";
use alibaba\nacos\Naming;
use alibaba\nacos\Nacos;
use alibaba\nacos\NacosConfig;

Nacos::init(
... "http://{IP}:8848/",
... "dev",
... "",
... "XXX_GROUP",
... ""
... )->runOnce();
[2021-05-20 08:11:04] nacos-client.ERROR: 获取配置异常,开始从本地获取配置, message: Client error: GET http://{IP}:8848/nacos/v1/cs/configs?standaloneParameterList%5B0%5D=uri&standaloneParameterList%5B1%5D=verb&tenant=&dataId=&group=XXX_GROUP resulted in a 403 Forbidden response: {"timestamp":"2021-05-20T08:11:05.097+0000","status":403,"error":"Forbidden","message":"unknown user!","path":"/nacos/v1 (truncated...) [] []

from php-nacos.

kestrelbright avatar kestrelbright commented on June 9, 2024

同问:

require "vendor/autoload.php";
use alibaba\nacos\Naming;
use alibaba\nacos\Nacos;
use alibaba\nacos\NacosConfig;

Nacos::init(
... "http://{IP}:8848/",
... "dev",
... "",
... "XXX_GROUP",
... ""
... )->runOnce();
[2021-05-20 08:11:04] nacos-client.ERROR: 获取配置异常,开始从本地获取配置, message: Client error: GET http://{IP}:8848/nacos/v1/cs/configs?standaloneParameterList%5B0%5D=uri&standaloneParameterList%5B1%5D=verb&tenant=&dataId=&group=XXX_GROUP resulted in a 403 Forbidden response: {"timestamp":"2021-05-20T08:11:05.097+0000","status":403,"error":"Forbidden","message":"unknown user!","path":"/nacos/v1 (truncated...) [] []

NacosConfig::setUsername('xxx');
NacosConfig::setPassword('xxx');
Nacos::init(
       "http://ip:port",
       "xx",
       "xx",
       "DEFAULT_GROUP",
       ""
)->listener();

NacosClient

$listenerConfigRequest->setUsername(NacosConfig::getUsername());
$listenerConfigRequest->setPassword(NacosConfig::getPassword());

ConfigRequest.php

private $username;
private $password;

/**
* @return mixed
*/
public function getUsername() {
    return $this->username;
}

/**
* @param mixed $username
*/
public function setUsername($username) {
    $this->username = $username;
}

/**
* @return mixed
*/
public function getPassword() {
    return $this->password;
}

/**
* @param mixed $password
*/
public function setPassword($password) {
    $this->password = $password;
}

NacosConfig.php

private $username;
private $password;

/**
* @return mixed
*/
public function getUsername() {
    return $this->username;
}

/**
* @param mixed $username
*/
public function setUsername($username) {
    $this->username = $username;
}

/**
* @return mixed
*/
public function getPassword() {
    return $this->password;
}

/**
* @param mixed $password
*/
public function setPassword($password) {
    $this->password = $password;
}

from php-nacos.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.