php 相关问题

PHP(PHP:Hypertext Preprocessor)是一种广泛使用的,高级,动态,面向对象和解释的脚本语言,主要用于服务器端Web开发。

Prestashop:会话 cookies 和登录

我需要一些有关为 Prestashop 进行集中登录(前台)的基础知识的帮助 - 一个单独的登录页面。 我安装了包含多个商店(多商店)的 Prestashop...

回答 1 投票 0

PHP 解析错误:语法错误,意外标记“{”,期望“;”

有人可以帮我检查以下代码中的语法以及为什么会出现错误吗? 我尝试更新我的 WordPress 文件之一以使用新的函数语法: {$if=函数(){

回答 1 投票 0

选中时使用特定值的复选框显示数据

我正在尝试使用多个 true(1) 或 false(0) 值显示来自 mysql 的数据,但无法识别使用复选框类型显示它们的方法。我想显示结果为真的结果...

回答 2 投票 0

Laravel 支付网关 - Softon\Indipay\Exceptions\IndipayParametersMissingException

我在本地系统上有一个 Laravel 项目,我使用了以下包作为 ccavenue 支付网关。 包名称:https://github.com/softon/indipay 以下是我的配置文件 '

回答 2 投票 0

运行时使用 docker-compose.yml 退出,代码为 0

我正在使用 Docker 运行 PHP Apache 服务器。这是我的 docker-compose.yml 文件内容: 版本:'3' 服务: php: 图片:php:8.2-cli 端口: - '3000:80' 卷: - /U...

回答 1 投票 0

Laravel 检查给定 url 的路由是否存在于路由中

通过提供 URL,我想知道是否有任何方法可以确定该 URL 是否存在于我的 Laravel 应用程序中(与“如何通过 Laravel 检查 URL 是否存在?”相比,它想要...

回答 3 投票 0

docker SQLSTATE[HY000] [1045]用户'user'@'172.18.0.3'的访问被拒绝

我正在尝试 dockerize laravel 应用程序,但收到此错误 SQLSTATE[HY000] [1045] 用户“user”@“172.18.0.3”的访问被拒绝 docker-compose.yml 版本:“3.8” 服务: #

回答 1 投票 0

Require(): 需要打开失败(include_path='.;C:\xampp\php\PEAR')

我已经使用 mvc 框架创建了一个网站,但我无法将 php 文件包含在来自其他文件夹的文件中。例如,我有模型、视图、控制器和核心文件夹,如果我执行以下操作

回答 3 投票 0

Raspberry Pi 在 PHP 网页上显示 Raspberry Pi 的称重传感器输出?

如何在 PHP 网页上显示连接到 Raspberry Pi 的称重传感器的输出?我在 Raspberry Pi 上创建了一个网页,想要在其上显示称重传感器输出,但我的代码不起作用...

回答 1 投票 0

根据 WooCommerce 中的自定义字段以编程方式更改产品变化价格

我只有可变产品具有自定义基本价格。现在我只想更改单个产品页面、购物车页面和结账页面中的每个变体价格,而不会对每个原始价格产生任何影响。 让我们假设,我

回答 1 投票 0

如何在 woocommrce 中覆盖变化价格?

我只有可变产品具有自定义基本价格。现在我只想更改单个产品页面、购物车页面和结账页面中的每个变体价格,而不会对每个原始价格产生任何影响。 让我们假设,我

回答 1 投票 0

使用 python 脚本的 WordPress 自定义插件

Python 脚本可以在 WordPress 上运行吗?我可以创建一个使用它的插件吗? 我必须制作一个自定义聊天机器人。我的代码可以完美运行,但是我遇到了一些问题......

回答 1 投票 0

docker SQLSTATE[HY000] [1045]用户'samson'@'172.18.0.3'的访问被拒绝

我正在尝试 dockerize laravel 应用程序,但收到此错误 SQLSTATE[HY000] [1045] 用户“user”@“172.18.0.3”的访问被拒绝 docker-compose.yml 版本:“3.8” 服务: #

回答 1 投票 0

在服务器端编程领域,php 或 Node js 更好

我是 Masoud Sharifi Nia,我正在学习编程。我想知道学习和使用node js好还是php好,请给出您的答案,谢谢。 我研究了很多网站,但我...

回答 2 投票 0

如何在所有帖子中用 WordPress 中的新图像替换现有图像?

我想为 WordPress 创建一个插件,将所有非 webp 图像转换为 webp。 我创建了一个函数,它将文件路径作为参数,并从该文件创建一个新的 webp 图像。 不...

回答 1 投票 0

什么时候使用 $_SERVER['SCRIPT_URL'] 全局变量?

我一直在尝试从网址 https://lucasfrank.devlock/forgot_password?done=1 获取 /forgot_password 部分。我创建了以下函数: 函数 getBaseURI(): 字符串 { $basePath = imp...

回答 1 投票 0

使用 google-api-php-client 创建通知通道

我想创建一个通知通道,以便每次从我的工作区删除用户时我的 php 应用程序都会收到通知,我正在使用以下命令 我想创建一个通知通道,以便每次从我的工作区删除用户时我的 php 应用程序都会收到通知,我正在使用以下内容 <?php namespace App\Services; use App\Models\Student; use Exception; use Google\Service\Directory\Channel; use Illuminate\Support\Str; class WorkspaceAdminService { /* * Email address for admin user that should be used to perform API actions * Needs to be created via Google Apps Admin interface and be added to an admin role * that has permissions for Admin APIs for Users */ protected string $delegatedAdmin; /* * Some name you want to use for your app to report to Google with calls, I assume * it is used in logging or something */ protected string $appName; /* * Array of scopes you need for whatever actions you want to perform * See https://developers.google.com/admin-sdk/directory/v1/guides/authorizing */ protected $scopes = array( \Google\Service\Directory::ADMIN_DIRECTORY_USER, \Google\Service\Directory::ADMIN_DIRECTORY_ORGUNIT, ); /* * Provide path to JSON credentials file that was downloaded from Google Developer Console * for Service Account */ protected $authJson; /** * @var \Google\Service\Directory $dir **/ protected $dir; public function __construct() { $authJson = resource_path('jsons/eservices-emails-creds.json'); $this->appName = env("GOOGLE_APP_NAME"); $this->delegatedAdmin = env("GOOGLE_DELEGATED_ADMIN"); /* * Create Google_Client for making API calls with */ $googleClient = new \Google\Client(); $googleClient->setApplicationName($this->appName); $googleClient->useApplicationDefaultCredentials(); $googleClient->setAuthConfig($authJson); $googleClient->setSubject($this->delegatedAdmin); $googleClient->setScopes($this->scopes); $googleClient->setAccessType('offline'); /* * Get an instance of the Directory object for making Directory API related calls */ $this->dir = new \Google\Service\Directory($googleClient); } public function watch(string $url) { $channel = new Channel(); $channel->setId(Str::uuid()->toString()); $channel->setAddress($url); $channel->setType('web_hook'); try { $this->dir->users->watch($channel, [ 'event' => 'delete', ]); } catch (Exception $e) { dd($e); } } } 但它抛出以下异常 { "error": { "code": 400, "message": "Bad Request", "errors": [ { "message": "Bad Request", "domain": "global", "reason": "badRequest" } ] } } 注意 jsons/eservices-emails-creds.json 是从控制台下载的凭证文件,在添加像 $this->dir->users->insert($user) 这样的用户时它可以工作,但创建通知通道失败 尝试在参数数组中添加域: $this->dir->users->watch($channel, [ 'event' => 'delete', 'domain' => 'yourdomain.com' ]); 我将此类用于 $channel 变量: $channel = new Google_Service_Directory_Channel();

回答 1 投票 0

PHP Readonly 属性不能通过引用传递?

<?php declare(strict_types=1); class Example { public readonly array $setOne; public readonly array $setTwo; public function __construct() { // Populate $setOne and $setTwo with a lot of data } public function doThing() { $map = [ 'one' => &$this->setOne, 'two' => &$this->setTwo, ]; // Loop over the Map and evaluate the data // Take action on the data, but don't try to change it } } 当我尝试在 PHP >=8.1 中创建只读属性的 reference 时,我收到错误 Fatal error: Uncaught Error: Cannot modify readonly property。如果我尝试执行类似 unset($map['one'][0]); 之类的操作,这是有意义的。但是,我仅通过创建引用就收到此错误。 为什么创建引用被视为 PHP 的修改? 如果您需要在不冒修改风险的情况下使用只读属性的值,则可以直接使用值或创建数据副本。 试试这个: public function doThing(){ $values = [ 'one' => $this->setOne, // Use value directly 'two' => $this->setTwo, ]; // Now loop over $values and work with the data }

回答 1 投票 0

从 PHP 中的帖子获取 Instagram 订阅 JSON 数据

Instagram API 的整个订阅过程似乎并不那么简单。 我设置了一些代码来接收 Instagram 向我发送通知时发送的帖子数据...

回答 3 投票 0

使用 DefaultQuoteStrategy::getColumnName() 将 Doctrine ORM 从 2.2 升级到 3.0 时出现问题

当我将 Doctrine/orm 从 2.2 升级到 3.0 时,我的 Symfony 6.4 遇到了问题。错误说: Doctrine\ORM\Mapping\DefaultQuoteStrategy::getColumnName():返回值必须是字符串类型,null

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.