小编RJ_*_*J_7的帖子

通过 VPN 连接 RDS

我的 MySQL 数据库存储在 AWS RDS 中。我需要将此数据库连接到由另一个提供商托管的我的网站。但我在AWS中没有公共IP。所以他们告诉我通过VPN连接。我怎样才能做到这一点?

amazon-web-services amazon-rds

5
推荐指数
1
解决办法
9203
查看次数

使用 Angular 5 将 POST 数据发送到 php

我正在尝试从 Angular 5 调用 Web 服务到 PHP。

我正在使用 POST 方法,但在 PHP 端检索数据时遇到问题。

发送数据显示在有效负载中,但不会在 php 端检索。

角度服务.ts

this.URL = "http://localhost/angular/WEBSERVICE_PHP/test.php";

const headers = new Headers();
headers.append('Content-Type', 'application/json');
let data = 'visitor_id=55';

return this.http
.post(this.URL,JSON.stringify(data),{
    headers: headers
})
.map( Response => console.log(Response) );
Run Code Online (Sandbox Code Playgroud)

PHP页面

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Methods: POST, GET");
header('P3P: CP="CAO PSA OUR"'); // Makes IE to support cookies
header('content-type: text/plain');  
header("content-type: application/x-www-form-urlencoded");
header("Access-Control-Allow-Headers: Content-Type, Authorization, X- 
Requested-With");
header("Access-Control-Max-Age: 172800");

if(isset($_POST))
{
    // $post = 'test data';     // This data …
Run Code Online (Sandbox Code Playgroud)

php rest web-services angular angular5

2
推荐指数
1
解决办法
4993
查看次数

如何获取仅在分页的材料数据表页面中显示的数据

我需要将页面上当前显示的数据导出为 excel 或 pdf。那么我怎么能得到只显示在页面上的数据。我将整个数据存储在数据源对象中。例如:- 如果每页的项目是 10 ,我需要 10 项目。如果我将分页器项目列表更改为 20,那么我需要 20 个项目。

组件 HTML

   <table mat-table [dataSource]="dataSource" class="mat-elevation-z8 mat_datatable" matSort matSortActive="total_click" matSortDirection="desc" multiTemplateDataRows matSortDisableClear>
Run Code Online (Sandbox Code Playgroud)

组件.ts

   import {MatPaginator, MatSort, MatTableDataSource} from 
  '@angular/material';

   this.dataSource = new MatTableDataSource(this.reports);
   this.dataSource.paginator = this.paginator;
   this.dataSource.sort = this.sort;    
Run Code Online (Sandbox Code Playgroud)

这是我的组件文件。

datatable pagination angular-material angular angular6

2
推荐指数
2
解决办法
2445
查看次数

如何将服务响应中的某些值存储到Angular 6中的数组?

我有一个Web服务调用,它返回一个值数组.我想将响应中的一些值存储到数组中.

Component.ts

     this.data.post_data('get/data',this.dataObj,true)
     .subscribe((data:any) => { 
         this.response= data.data;

      });
Run Code Online (Sandbox Code Playgroud)

Web服务响应

    0: {id: 785533, name: "UK ", avg: 0.6154,…}
    1: {id: 785533, name: "Usd ", avg: 0.698,…}
    2: {id: 785533, name: "ff ", avg: 50.61598,…}
    3: {id: 785533, name: "yy ", avg: 80.61198,…}
    4: {id: 785533, name: "nn ", avg: 10.618,…}
    5: {id: 785533, name: "mh ", avg: 0.6154898,…}
    6: {id: 785533, name: "tr ", avg: 70.615482198,…}
    7: {id: 785533, name: "es ", avg: 0.61548,…}
Run Code Online (Sandbox Code Playgroud)

我只需要将'name'和'avg'值保存到数组中.

arrays json rxjs angular angular6

0
推荐指数
1
解决办法
387
查看次数