我想从字符串中提取电子邮件地址,例如:
<?php // code
$string = 'Ruchika <ruchika@example.com>';
?>
Run Code Online (Sandbox Code Playgroud)
从上面的字符串我只想获得电子邮件地址ruchika@example.com.
请注意,建议如何实现这一目标.
我正在使用react-chartJs-2库来显示图表。假设,用户点击条形图/甜甜圈图部分,他必须被重定向到特定页面。以下是我为 DoughnutChart 所做的代码:
<div className="DonutChartSection" >
<Doughnut labelArray = {this.state.labelArr} DataArray = {this.state.DoughnutDataArr} colorArray = {this.state.DoughnutColorArr} title={"Employees"} />
</div>
Run Code Online (Sandbox Code Playgroud)
Doughnut.jsx
import React from 'react';
import {Doughnut} from 'react-chartjs-2';
Chart.defaults.global.defaultFontStyle = 'Bold';
Chart.defaults.global.defaultLegendPosition = 'left';
export default class DoughnutChartView extends React.Component{
constructor(props) {
super(props);
this.state = { };
}
render() {
let data = {
labels: this.props.labelArray,
datasets: [{
data: this.props.DataArray,
backgroundColor: this.props.colorArray,
hoverBackgroundColor: this.props.colorArray,
}]
}
return (
<div>
<span className="titleName" >{this.props.title}</span>
<Doughnut data={data} />
</div>
); …Run Code Online (Sandbox Code Playgroud)