init-parameters 相关问题


Go 中何时/如何调用和使用 init()?

在Win 11 Pro机器上使用Go 1.21.4并为Go绑定GTK 3。 对 Go 中何时/如何调用和使用 init() 函数感到困惑。 简单示例代码: 包 GTKView 进口 ( “github...


GoLang 中何时/如何调用和使用 init()?

在Win 11 Pro机器上使用Go 1.21.4并为Go绑定GTK 3。 对 Go 中何时/如何调用和使用 init() 函数感到困惑。 简单示例代码: 包 GTKView 进口 ( “github...


未捕获错误:未找到“Instamojo\Exception\InstamojoException”类

$authType = "应用程序/用户"; $api = Instamojo\Instamojo::init($authType,[ “client_id”=>“XXXXXQAZ”, “client_secret”=>“XXXXQWE”, ],真的); ...


尝试使用“gcloud init”进行身份验证时出错

我正在尝试使用 gcloud init 验证 gcloud sdk。 我得到了一个应该访问的 URL,以便复制令牌并将其返回到 CLI...但我得到的不是令牌,而是以下错误: ...


放大init UnauthorizedException

我正在使用以下文档学习放大器 https://docs.amplify.aws/angular/start/getting-started/installation/ https://docs.amplify.aws/angular/start/getting-started/setup/ 但同时


如何选择两个td并用bs4作为单行输出?

我想获取一些数据,但我很难选择两个 td 并将输出放在它们所属的同一行上。 HTML 示例: ፳ 我想获取一些数据,但我很难选择两个td并将输出放在它们所属的同一行。 HTML 示例: <tr> <td class ='verseNumCell'> ፳ </td> <td class ='verseConentCell'> ወትቤሎን ኢትስምያኒ ኖሔሚን ስምያኒ መራር እስመ መረርኩ ፈድፋደ ወብዙኀ ። </td> </tr> <tr> <td class ='verseNumCell'> ፳፩ </td> <td class ='verseConentCell'> አንሰ ምልእትየ ሖርኩ ወዕራቅየ አግብአኒ <span class='divineWord'>እግዚአብሔር</span> ለምንት ትብላኒ ኖሔሚን እንዘ <span class='divineWord'>እግዚአብሔር</span> አኅሰረኒ ወፈድፋደ አሕመመኒ ። </td> </tr> <tr> 我做了什么: import bs4 import requests import re url = "https://www.ethiopicbible.com/books/%E1%8A%A6%E1%88%AA%E1%89%B5-%E1%8B%98%E1%8D%8D%E1%8C%A5%E1%88%A8%E1%89%B5-1" parameters = {} response = requests.get(url, params=parameters) soup = bs4.BeautifulSoup(response.text, "html.parser") element_list = soup.find("div", class_="geezBibleChapterContainer").find_all("td") for element in element_list: text = element.get_text() text = os.linesep.join([s for s in text.splitlines() if s]) if not re.match(r'^\s*$', text): print(text) 我的输出: ፳ ወትቤሎን ኢትስምያኒ ኖሔሚን ስምያኒ መራር እስመ መረርኩ ፈድፋደ ወብዙኀ ። ፳፩ አንሰ ምልእትየ ሖርኩ ወዕራቅየ አግብአኒ እግዚአብሔር</span> ለምንት ትብላኒ ኖሔሚን እንዘ 我想得到什么: ፳ ወትቤሎን ኢትስምያኒ ኖሔሚን ስምያኒ መራር እስመ መረርኩ ፈድፋደ ወብዙኀ ። ፳፩ አንሰ ምልእትየ ሖርኩ ወዕራቅየ አግብአኒ እግዚአብሔር</span> ለምንት ትብላኒ ኖሔሚን እንዘ 我应该在单独的“汤”中选择 td 吗? 无需选择单元格,只需选择每一行并使用 get_text(separator=' ',strip=True): for row in soup.select('div.geezBibleChapterContainer tr'): print(row.get_text(' ',strip=True)) 什么导致: ፩ በቀዳሚ ገብረ እግዚአብሔር ሰማየ ወምድረ ። ፪ ወምድርሰ ኢታስተርኢ ወኢኮነት ድሉተ ወጽልመት መልዕልተ ቀላይ ወመንፈሰ እግዚአብሔር ይጼልል መልዕልተ ማይ ። ፫ ወይቤ እግዚአብሔር ለይኩን ብርሃን ወኮነ ብርሃን ። ፬ ወርእዮ እግዚአብሔር ለብርሃን ከመ ሠናይ ወፈለጠ እግዚአብሔር ማእከለ ብርሃን ወማእከለ ጽልመት ። ፭ ወሰመዮ እግዚአብሔር ለብርሃን ዕለተ ወለጽልመት ሌሊተ ወኮነ ሌሊተ ወጸብሐ ወኮነ መዓልተ ፩ ። ፮ ወይቤ እግዚአብሔር ለይኩን ጠፈር ማእከለ ማይ ከመ ይፍልጥ ማእከለ ማይ ወኮነ ከማሁ ። ፯ ወገብረ እግዚአብሔር ጠፈረ ወፈለጠ እግዚአብሔር ማእከለ ማይ ዘታሕተ ጠፈር ወማእከለ ማይ ዘመልዕልተ ጠፈር ። ፰ ወሰመዮ እግዚአብሔር ለውእቱ ጠፈር ሰማየ ወርእየ እግዚአብሔር ከመ ሠናይ ወኮነ ሌሊተ ወጸብሐ ወኮነ ካልእተ ዕለተ ። 示例 import requests import bs4 url = "https://www.ethiopicbible.com/books/%E1%8A%A6%E1%88%AA%E1%89%B5-%E1%8B%98%E1%8D%8D%E1%8C%A5%E1%88%A8%E1%89%B5-1" parameters = {} response = requests.get(url, params=parameters) soup = bs4.BeautifulSoup(response.text, "html.parser") for row in soup.select('div.geezBibleChapterContainer tr'): print(row.get_text(separator=' ',strip=True))


-bash:rbenv:找不到命令

我尝试通过 ruby rbnev 安装 jekyll,然后将 open ~/.bash_profile 放入终端并在文本编辑器中输入 eval "$(rbenv init -bash)" ,这是唯一的方法...


为什么 goGTK 小部件没有在 init() 函数中初始化? [已关闭]

我在 Windows 11 Pro 机器上使用 Go 1.21.4,并使用 GTK 3 绑定 Go。 简单示例代码: 包 GTKView 进口 ( “github.com/gotk3/gotk3/gtk” ) var mToolbar *gtk.Toolbar 变...


TS2740:(TS) 类型“VNode”缺少类型“HTMLElement”中的以下属性:accessKey、accessKeyLabel、autocapitalize、dir 以及其他 283 个属性

`类型“VNode”缺少类型“HTMLElement”中的以下属性:accessKey、accessKeyLabel、autocapitalize、dir 以及其他 283 个属性。 > 导入 { init, classModule, propsModule, styleModule,


SwiftUI:@StateObject init多次

我正在尝试优化我的 SwiftUI 应用程序。我有一个奇怪的行为,ViewModel 在其视图中存储为 @StateObject。为了理解这个问题,我做了一个小项目来重现它。 内容视图


同一属性上的 Init + 私有集访问器?

是否可以在同一属性上使用公共初始化访问器和私有设置器? 目前我收到错误 CS1007“属性访问器已定义”。 公共记录的东西 { 公共...


无法访问“<init>”:它在“Image”中是包私有的

Android studio,我想用内置方法“Image”发布一个简单的图像。编译器抛出了我在标题中发布的内容。 我正在尝试不同的图像选项和 ImageView 没有


如何使用cloud-init和Terraform设置主机名?

我从 Terraform 开始。我试图让它设置一个友好的主机名,而不是AWS通常使用的ip-10.10.10.10。但是,我还没有找到如何做到这一点。 我尝试使用配置程序,...


init方法调用失败; Spring 4 Hibernate 4 项目中的嵌套异常是 java.lang.NullPointerException

我正在尝试使用纯Java配置来设置一个没有XML配置的spring 4 + hibernate 4 Web应用程序。 同时我在启动时遇到以下错误。 13:32:47,649 错误 [org.jb...


如何使用第一个iter的输入来初始化模块中的变量?

我想使用与输入相关的东西来初始化模块中的属性,在第一个 iter 之前,它在 init() 中初始化为零 类模型(nn.Module): def __init__(自身): 超级(模特,自我)。


当我在“sanity init”成功后尝试执行“sanity start”时出现错误

我正在尝试安装 Sanity studio,我按照以下步骤操作: npm install --global @sanity/cli 理智安装 理智初始化 在初始化步骤之后,我尝试运行下一步: 理智开始 但它...


Node v20.10.0 未针对您平台上的 Ember CLI 进行测试

当我尝试启动新的 ember 项目时遇到错误。 我刚刚使用以下命令安装了 ember: npm install -g ember-cli 然后我运行: ember init 来创建我的项目,但它抛出了以下错误...


本地主机上的我的 Parcel React 网站在使用 chrome 检查选项卡打开时需要 10 秒时间,并且在未打开检查选项卡时快速加载

我正在从akshay saini的合十礼反应课程中学习反应。 我创建了 2 个文件。 索引.html 脚本.js 然后我启动了npm init。 之后我向其中添加了包裹,然后运行 npx 包裹索引.h...


棱镜:ViewModelLocator.AutowireViewModel 不适用于内容视图

我正在将使用 Prism 的 Xamarin.Forms 应用程序迁移到 .NET Maui。该应用程序有一个 TabbedPage 导航。此迁移有效。 但是 ContentPages 包含几个 ContentView,如下所示: 我正在将使用 Prism 的 Xamarin.Forms 应用程序迁移到 .NET Maui。该应用程序有一个 TabbedPage 导航。此迁移有效。 但是 ContentPages 包含几个 ContentView,如下所示: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:views="clr-namespace:MauiDemo.Views" x:Class="MauiDemo.Views.HomePage" Title="HomePage"> <VerticalStackLayout> <views:FirstContentView HeightRequest="200"/> <views:SecondContentView HeightRequest="200"/> </VerticalStackLayout> </ContentPage> 在 Xamarin 中,我能够将 prism:ViewModelLocator.Autowire="true" 属性添加到 contentview 中,并且 prism 找到了关联的视图模型。在 .NET maui 中,prism:ViewModelLocator.AutowireViewModel="Automatic" 属性没有任何作用。 例如,ContentView 的名称是 “FirstContentView”。关联的viewModel的名称是“FirstContentViewViewModel” 根据https://prismlibrary.com/docs/maui/migration.html中的描述,它应该可以工作,但事实并非如此。 配置这样的自动接线有什么技巧吗? 我使用 prism 存储库的当前克隆 https://github.com/PrismLibrary/Prism 以及带有最新 MAUI 组件的当前 .NET8 SDK 我使用区域而不是通过自动装配。具有不同 ContentView 的页面应该如下所示 <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:views="clr-namespace:MauiDemo.Views" xmlns:prism="http://prismlibrary.com" x:Class="MauiDemo.Views.HomePage" Title="HomePage"> <VerticalStackLayout> <ContentView prism:RegionManager.RegionName="FirstContent"/> <ContentView prism:RegionManager.RegionName="SecondContent"/> </VerticalStackLayout> </ContentPage> 所需的视图及其视图模型应在 MauiProgram 中注册为 RegisterForRegionNavigation container.RegisterForRegionNavigation<FirstContentView, FirstContentViewViewModel>(); container.RegisterForRegionNavigation<SecondContentView, SecondContentViewModel>(); .UsePrism(prism => { prism.RegisterTypes(container => { container.RegisterForNavigation<MainPage,MainPageViewModel>(); container.RegisterForNavigation<HomePage>(); container.RegisterForRegionNavigation<FirstContentView, FirstContentViewViewModel>(); container.RegisterForRegionNavigation<SecondContentView, SecondContentViewModel>(); }) .CreateWindow(navigationService => navigationService.CreateBuilder() .AddSegment<MainPage>() .NavigateAsync(HandleNavigationError)); }) 包含多个ContentView的页面的ViewModel应该为所需的ContentView调用RegionManager.RequestNavigate方法。 public class HomePageViewModel : ViewModelBase, IInitialize { private readonly IRegionManager _regionManager; public HomePageViewModel(IRegionManager regionManager) { _regionManager = regionManager; } public void Initialize(INavigationParameters parameters) { _regionManager.RequestNavigate("FirstContent", nameof(FirstContentView)); _regionManager.RequestNavigate("SecondContent", nameof(SecondContentView)); } } 仅此而已。它的工作原理如https://xamgirl.com/prism-regions-in-xamarin-forms/所述


Flatpickr AlpineJS 在危险范围选择上坚持插件

我有一个工作完美的 Flatpickr 日期范围日历,它将日期存储在会话存储中。这是我的代码: 我有一个工作完美的 Flatpickr 日期范围日历,它将日期存储在会话存储中。这是我的代码: <div x-data="{ chosenDates: sessionStorage.getItem('_x_range'), value: [], init() { let picker = flatpickr(this.$refs.picker, { mode: 'range', inline: false, dateFormat: 'm/d/Y', showMonths: 2, }) this.$watch('value', () => picker.setDate(this.value)) }, }" > <div class="flex items-center flex-1 gap-2 overflow-hidden border border-gray-500 rounded-lg"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="ml-4 bi bi-calendar-event-fill" viewBox="0 0 16 16"> <path d="M4 .5a.5.5 0 0 0-1 0V1H2a2 2 0 0 0-2 2v1h16V3a2 2 0 0 0-2-2h-1V.5a.5.5 0 0 0-1 0V1H4zM16 14V5H0v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2m-3.5-7h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5"/> </svg> <input id="rangeValue" :value="chosenDates" placeholder="Add dates" x-ref="picker" type="text" class="p-0 py-4 placeholder-gray-600 border-0 bg-none focus:ring-0 " data-input> </div> </div> 设置项目: function dateRange() { var date = document.getElementById("rangeValue").value; sessionStorage.setItem("_x_range", date); sessionStorage.setItem("start", start); sessionStorage.setItem("end", end); const start = sessionStorage.getItem("start"); } $('#rangeValue').on('focus', ({ currentTarget }) => $(currentTarget).blur()) $("#rangeValue").prop('readonly', false) ``` Receive item: if (sessionStorage.getItem("_x_range") != null) { document.getElementById("chosenRange").innerHTML = sessionStorage.getItem("_x_range"); document.getElementById("rangeValue").value = sessionStorage.getItem("_x_range"); } ``` 如果可能的话,我想学习如何使用 AplineJS 和 Persist 来设置它,以免代码过多而过期。 这可能吗? 这是一个可能的解决方案: <div x-data="{ thePicker: null, chosenDates: $persist([]).using(sessionStorage).as('_x_range'), init() { this.thePicker = flatpickr(this.$refs.picker, { mode: 'range', inline: false, dateFormat: 'm/d/Y', showMonths: 2, defaultDate: this.chosenDates, onChange: (selectedDates) => {this.chosenDates = [...selectedDates];} }); }, }" > <div class="flex items-center flex-1 gap-2 overflow-hidden border border-gray-500 rounded-lg"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="ml-4 bi bi-calendar-event-fill" viewBox="0 0 16 16"> <path d="M4 .5a.5.5 0 0 0-1 0V1H2a2 2 0 0 0-2 2v1h16V3a2 2 0 0 0-2-2h-1V.5a.5.5 0 0 0-1 0V1H4zM16 14V5H0v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2m-3.5-7h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5"/> </svg> <input type="text" x-ref="picker" placeholder="Add dates" class="p-0 py-4 placeholder-gray-600 border-0 bg-none focus:ring-0" > <span title="Clear" class="text-blue-600 cursor-pointer" @click="thePicker.clear()" > X </span> </div> <div x-text="chosenDates"> </div> </div> 日期范围存储在 Alpine chosenDates 变量中,该变量通过 Persist 进行持久化并初始化为空数组。 当日期选择器初始化时,chosenDates变量用于填充defaultDate参数。 选择日期范围后,flatpicker 会触发 onChage 事件,因此我使用它将新范围复制到 chosenDates 变量中。 我添加了一个 “clear” 按钮以 flatpicker 方式重置输入字段,调用 clear() 方法(这是一个简单的示例),然后我必须将 flatpicker 引用存储在 thePicker 中变量. 我还添加了一个 通过 x-text 显示 choosenDates 的内容


Struts 2 与 Apache Shiro 集成时如何显示结果页面

使用: struts2 2.5.10, 春天 4.x, struts2-spring-插件2.5.10, 希罗1.4.0, Shiro-Spring 1.4.0。 网络.xml: 使用: struts2 2.5.10, 春季 4.x, struts2-spring-插件2.5.10, 四郎1.4.0, shiro-spring 1.4.0. web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <display-name>Archetype Created Web Application</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:beans.xml</param-value> </context-param> <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> <init-param> <param-name>targetFilterLifecycle</param-name> <param-value>true</param-value> </init-param> </filter> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <!-- shiro filter mapping has to be first --> <filter-mapping> <filter-name>shiroFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>ERROR</dispatcher> </filter-mapping> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> beanx.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd "> <bean name="loginAction" class="example.shiro.action.LoginAction" > </bean> <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> <property name="securityManager" ref="securityManager" /> <property name="loginUrl" value="/login.jsp" /> <property name="filterChainDefinitions"> <value> /login.jsp = authc /logout = logout /* = authc </value> </property> </bean> <bean id="iniRealm" class="org.apache.shiro.realm.text.IniRealm"> <property name="resourcePath" value="classpath:shiro.ini" /> </bean> <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realm" ref="iniRealm" /> </bean> <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/> </beans> struts.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <constant name="struts.devMode" value="true" /> <package name="default" extends="struts-default"> <action name="list" class="loginAction" method="list"> <result name="success">/success.jsp</result> <result name="error">error.jsp</result> </action> </package> </struts> index.jsp: <body> <s:action name="list" /> </body> login.jsp 看起来像: <form name="loginform" action="" method="post"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr> <td>Username:</td> <td><input type="text" name="username" maxlength="30"></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="password" maxlength="30"></td> </tr> <tr> <td colspan="2" align="left"><input type="checkbox" name="rememberMe"><font size="2">Remember Me</font></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="submit" value="Login"></td> </tr> </table> </form> LoginAction.list(): public String list() { Subject currentUser = SecurityUtils.getSubject(); if(currentUser.isAuthenticated()) {System.out.println("user : "+currentUser.getPrincipal()); System.out.println("You are authenticated!"); } else { System.out.println("Hey hacker, hands up!"); } return "success"; } shiro.ini: [users] root=123,admin guest=456,guest frank=789,roleA,roleB # role name=permission1,permission2,..,permissionN [roles] admin=* roleA=lightsaber:* roleB=winnebago:drive:eagle5 index.jsp、login.jsp、success.jsp放在webapp下 我想要的是:输入LoginAction.list()需要进行身份验证,如果登录成功,则运行LoginAction.list()并返回"success"然后显示定义为Struts操作结果的success.jsp。 现在登录成功后可以执行LoginAction.list(),但是success.jsp不显示,浏览器是空白页面。 为什么? 我找到了原因:我在index.jsp中使用了<s:action name="list" />,但是struts文档说如果我们想用<s:action>看到结果页面,那么我们必须将其属性executeResult设置为true,即就像<s:action name="list" executeResult="true"/>。 在我看来,这有点奇怪,这个属性默认应该是 true。 有一个示例,您应该如何使用 Shiro applicationContext.xml 进行配置: <property name="filterChainDefinitions"> <value> # some example chain definitions: /admin/** = authc, roles[admin] /** = authc # more URL-to-FilterChain definitions here </value> </property> 以 /admin/ 开头的 URL 通过角色 admin 进行保护,任何其他 URL 均不受保护。如果 Struts 操作和结果 JSP 不在受保护区域中,则会显示它们。


为什么我的全景切换按钮不起作用?

我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户观看 360 度全景图时,按钮不应旋转。 我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户查看 360 度全景图时,按钮不应旋转。 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>panoramas</title> <script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script> <style> #switchButton { cursor: pointer; } </style> </head> <body> <a-scene> <a-assets> <img id="panorama1" src="1.jpg"> <img id="panorama2" src="2.jpg"> </a-assets> <a-sky id="panorama" src="#panorama1" rotation="0 -130 0"></a-sky> <a-entity id="cameraRig"> <a-camera></a-camera> </a-entity> <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#CCC" id="switchButton"></a-plane> </a-scene> <script> const button = document.querySelector('#switchButton'); let currentPanorama = 1; button.addEventListener('mouseenter', () => { const panorama = document.querySelector('#panorama'); if (currentPanorama === 1) { panorama.setAttribute('src', '#panorama2'); currentPanorama = 2; } else { panorama.setAttribute('src', '#panorama1'); currentPanorama = 1; } }); </script> </body> </html> 我正在尝试制作一个按钮,以便将其绑定到全景图中的特定位置。也就是说,当用户查看 360 度全景图时,按钮不应旋转。 我解决你的问题 您需要做的是添加一个光标来处理 onlcick 事件,这是唯一的方法。 <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width"> <title>A-Frame HTML Shader - Dynamic</title> <script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script> <script src="https://unpkg.com/[email protected]/dist/aframe-html-shader.min.js"></script> <script> let currentPanorama = 1; AFRAME.registerComponent("click-log", { init: function () { this.myFunction = function () { const panorama = document.querySelector('#panorama'); if (currentPanorama === 1) { panorama.setAttribute('src', '#panorama2'); currentPanorama = 2; } else { panorama.setAttribute('src', '#panorama1'); currentPanorama = 1; } }; this.el.addEventListener("click", this.myFunction); }, remove: function () { this.el.removeEventListener("click", this.myFunction); } }); </script> </head> <body> <a-scene update-html> <a-camera> <a-cursor material="color: red"></a-cursor> </a-camera> <a-assets> <img id="panorama1" src="https://l13.alamy.com/360/PWNBM9/testing-new-cameralens-combination-in-my-garden-in-aarhus-denmark-PWNBM9.jpg"> <img id="panorama2" src="https://aframe.io/aframe/examples/boilerplate/panorama/puydesancy.jpg"> </a-assets> <a-sky id="panorama" src="#panorama1" rotation="0 -130 0"></a-sky> <a-entity id="cameraRig"> <a-camera></a-camera> </a-entity> <a-plane click-log position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#CCC" id="switchButton"></a-plane> </a-scene> </body> </html>


Google 识别的 JSON LD 格式的 Schema.org,但 Facebook Pixel Helper 无法检测到它

我使用添加了JSON LD格式的schema.org标签,当我使用Google结构化数据测试工具测试我的页面时,我可以看到我的所有标签。 但是,当我安装 Facebook Pixel Helper 时 </desc> <question vote="15"> <p>我使用<pre><code>JSON LD</code></pre>以<pre><code>&lt;script&gt;</code></pre>格式添加了schema.org标签,当我使用<a href="https://search.google.com/structured-data/testing-tool/u/0/" rel="noreferrer">Google结构化数据测试工具</a>测试我的页面时,我可以看到我的所有标签。</p> <p>但是,当我安装 <a href="https://chrome.google.com/webstore/detail/facebook-pixel-helper/fdgfkebogiimcoedlicjlajpkdmockpc?hl=en" rel="noreferrer">Facebook Pixel helper chrome 扩展</a> 来测试我的页面时,schema.org 标签显示为空白。不知道为什么 Facebook Pixel Helper 无法检测到它。</p> <p>非常感谢任何帮助。</p> </question> <answer tick="false" vote="9"> <p>我发现Facebook Pixel对结构化数据的解析更加严格。字段中的空白换行将导致它发出警告。当我在地址中进行换行时,我就发生了这种情况。谷歌正确解释了该地址,但 Facebook Pixel 在控制台中发出了警告。</p> <p>添加以下代码解决了我的情况:</p> <pre><code>$address = preg_replace( &#34;/\r|\n/&#34;, &#34; &#34;, $address ); </code></pre> <p>当然,正如这里指出的那样<a href="https://stackoverflow.com/questions/2392766/multiline-strings-in-json">JSON不支持真正的换行符</a>。</p> </answer> <answer tick="false" vote="3"> <p>聚会迟到了,但对于来这里的人来说仍然如此。 FB Pixel 现在支持 JSON-LD:<a href="https://www.facebook.com/business/help/1175004275966513" rel="nofollow noreferrer">https://www.facebook.com/business/help/1175004275966513</a></p> </answer> <answer tick="false" vote="3"> <p>对我来说,多个空格都有错误(据我所知)。 <br/>因此,我使用这段代码:</p> <pre><code>$description = preg_replace(&#34;#\r|\n|(\s+)#iu&#34;, &#34; &#34;, $description); </code></pre> </answer> <answer tick="false" vote="0"> <p>JSON 扩展还为所有其他网页添加了 JSON-LD 格式的架构标记,这是 Google 喜欢的。 “Facebook Pixel”不读取架构元标签或 JSON-LD(Pinterest 读取架构元标签,但不读取 JSON-LD)。</p> <p>听起来您可能有点困惑 – Facebook 不读取架构标记 – Facebook 读取开放图元标签。您可以在这里找到该标准的详细信息:<a href="http://ogp.me/" rel="nofollow noreferrer">http://ogp.me/</a>。</p> <p>仅供参考 <a href="https://www.withintheflow.com/facebook-pixel-helper/" rel="nofollow noreferrer">https://www.withintheflow.com/facebook-pixel-helper/</a></p> </answer> <answer tick="false" vote="0"> <p>您可能碰巧在 init 调用中有 <pre><code>fbq(&#39;set&#39;, &#39;autoConfig&#39;, &#39;false&#39;)</code></pre>。 </p> <p>Facebook Pixel 会将元数据发送到您的 Pixel 设置,但在初始化代码中,如果您将 <pre><code>autoConfig</code></pre> 设置为 <pre><code>false</code></pre>,Facebook Pixel 将不会发送此附加信息。</p> </answer> <answer tick="false" vote="0"> <p>我还使用 Json-LD 脚本标签。就我而言,实际上是在标签开始发送此数据之前移动 Facebook 像素脚本!</p> </answer> </body></html>


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