我已经构建了一个带有颤动的应用程序,就像提醒一样.
即使应用程序已关闭,如何向用户显示通知?
mobile-application push-notification apple-push-notifications android-notifications flutter
我的项目在localhost上工作正常,但没有在线工作,这是错误:
Fatal error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strlen() in /home/stram/public_html/vendor/symfony/polyfill-mbstring/Mbstring.php on line 338
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索它,我发现我需要安装PHP扩展iconv.我正在使用VPS的问题,当我进入可用的PHP扩展列表时,我没有找到这个扩展!



Thnx提前.
我正在关注此链接以安装此PHP扩展,但我陷入了中间.
当我尝试运行此命令时,pecl install intl我收到以下消息:
Specify where ICU libraries and headers can be found [DEFAULT] :
Run Code Online (Sandbox Code Playgroud)
我不知道ICU库的位置.
如果我按Enter键我会收到此错误:
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
ERROR: `/private/tmp/pear/install/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' failed
Run Code Online (Sandbox Code Playgroud)
如何找到ICU库的正确路径?我正在使用PHP版本7.1的High Sierra和MAMP
我的 postgresql 数据库中有一个函数,如果存在则更新行,如果不存在则插入新行:
CREATE OR REPLACE FUNCTION insert_or_update(val1 integer, val2 integer) RETURNS VOID AS $$
DECLARE
BEGIN
UPDATE my_table SET col2 = val2 WHERE col1 = val1;
IF NOT FOUND THEN
INSERT INTO my_table (col2) values ( val2 );
END IF;
END;
$$ LANGUAGE 'plpgsql';
Run Code Online (Sandbox Code Playgroud)
目前它工作完美,但我想获取id行(如果更新或插入)。
我该怎么做?
我在两个实体之间有一个 ManyToOne 关系Parent,Child因此在FormType我使用的关系中CollectionType,如下所述:
class ParentType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('childs', CollectionType::class, array(
'entry_type' => ChildType::class,
));
}
}
Run Code Online (Sandbox Code Playgroud)
在 ChildType 类中,我想使用 EventListener 获取嵌入对象:
class ChildType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('lastName');
$builder->addEventListener(
FormEvents::POST_SET_DATA,//---after setting data
function (FormEvent $event) {
die(var_dump($event->getData()));//---this gives me null
}
);
}
}
Run Code Online (Sandbox Code Playgroud)
尽管我已将完整对象传递给控制器中的表单,但我得到的结果为 null: …
我试图将在Symfony 3. *上构建的旧捆绑软件添加到Symfony 4中,但出现此错误:
自动加载器的预期类“ App \ SBC \ TiersBundle \ Controller \ ChantierController”将在文件“ /Applications/MAMP/htdocs/Projects/HelloSymfony4/vendor/composer/../../src/SBC/TiersBundle/Controller/ ChantierController.php”。找到了文件,但没有类,文件名或名称空间可能在/Applications/MAMP/htdocs/Projects/HelloSymfony4/config/services.yaml中有错字(已加载到资源“ / Applications / MAMP / htdocs / Projects / HelloSymfony4 / config / services.yaml”)。
似乎框架无法识别捆绑软件的名称空间,因此我执行了以下步骤:
在config/bundle.php我添加了第三行:
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
\SBC\TiersBundle\TiersBundle::class => ['all' => true], // this one
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
];
Run Code Online (Sandbox Code Playgroud)
然后composer.json在autoload部分中添加第一行:
"autoload": {
"psr-4": {
"SBC\\": "src/SBC/",
"App\\": "src/" …Run Code Online (Sandbox Code Playgroud) 假设我有3个数据库:
而且我想像这样从url动态连接到它们,http://localhost/my-project/web/app_dev.php/db1/books所以我知道要从url连接到 哪个数据库(在这种情况下prefix_db1)
,基本上的想法是准备一个将随每个http请求触发的侦听器,获取数据库从URL名称,然后覆盖doctrin的参数,可以是这样的:
在services.yml:
dynamic_connection:
class: AppBundle\service\DynamicDBConnector
arguments: ['@request_stack']
calls:
- [ setDoctrineConnection, ['@doctrine.dbal.default_connection'] ]
tags:
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
Run Code Online (Sandbox Code Playgroud)
我的听众:
<?php
namespace AppBundle\service;
use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\RequestStack;
use Exception;
class DynamicDBConnector
{
/**
* @var Connection
*/
private $connection;
/*
* @var Request
*/
private $request;
public function __construct(RequestStack $requestStack)
{
$this->request = $requestStack->getCurrentRequest();
}
/**
* Sets the DB Name prefix …Run Code Online (Sandbox Code Playgroud) 我正在使用flutter_local_notifications,要创建通知(让我们专注于 android ),请执行以下操作:
var androidPlatformChannelSpecifics =
new AndroidNotificationDetails(
'your other channel id',
'your other channel name',
'your other channel description');
var iOSPlatformChannelSpecifics =
new IOSNotificationDetails();
NotificationDetails platformChannelSpecifics = new NotificationDetails(
androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics);
Run Code Online (Sandbox Code Playgroud)
正如您在 android 案例中看到的,您提供了 3 个与频道相关的参数
所以我的问题是这个频道的用途是什么,为什么在 android 中我们需要为它提供一个id、一个name和一个description?
我正在使用这个jquery 插件 来创建一个所见即所得的文本编辑器,
我创建了一个文本区域,我想在其中显示文本编辑器:
<textarea class="editor" rows="3" name="textEditor" id="textEditor"></textarea>
Run Code Online (Sandbox Code Playgroud)
然后我调用了 jquery 函数:
<script type="text/javascript">
$(document).ready( function() {
$("#textEditor").Editor();
});
</script>
Run Code Online (Sandbox Code Playgroud)
到目前为止,一切都运行良好,但是当我想知道使用此函数是否正确编写文本时:
function displayText(){
alert($("#textEditor").val());
}
Run Code Online (Sandbox Code Playgroud)
它给了我一个空文本!
我错过了什么?
所以我一直面临这个奇怪的问题,但我不确定这是一个错误还是我在这里遗漏了一些东西。
所以我有一个名为的组件TestComponent,在 AppComponent 中我有一个按钮,当我点击它时,我TestComponent通过这样做获得了名称TestComponent.name。
应用组件:
import { TestComponent } from './test/test.component';
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: '<button (click)="showName()">Show</button>'
})
export class AppComponent {
showName(){
console.log('component name: "' + TestComponent.name + '"');
}
}
Run Code Online (Sandbox Code Playgroud)
正如您通过单击按钮所看到的,我想获取 TestComponent 的名称,它基本上是“TestComponent”
问题是这在开发模式下运行良好,如果我调用ng build也可以正常工作,这就是我在控制台中得到的:
当我调用ng build --prod, 压缩文件并减小它们的大小时,我得到以下结果:

这正常吗?!
一个内部directive在Angular我做了以下内容:
let input: HTMLElement = renderer.createElement('input');
renderer.appendChild(this.elem.nativeElement, input);
Run Code Online (Sandbox Code Playgroud)
当我尝试使用以下方法获取此输入中的值时:
console.log('value', input.value);
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Property 'value' does not exist on type 'HTMLElement'.
Run Code Online (Sandbox Code Playgroud)
虽然我们现在都是使用javascript从输入中获取价值,但我们执行以下操作:
document.getElementById("searchTxt").value;
Run Code Online (Sandbox Code Playgroud)
并document.getElementById()返回null或HTMLElementobject:
/***返回对具有指定ID或NAME属性值的第一个对象的引用.*@param elementId指定ID值的字符串.不区分大小写.*/getElementById(elementId:string):HTMLElement | 空值;
为什么我得到这个错误?!!