$applicantAttr = [
'name' => 'Taylor Otwell',
'email' => 'vaibhav@coloredcow.com',
'phone' => '123321',
'college' => 'Sample college',
'graduation_year' => '2018',
'course' => 'Test Course',
'linkedin' => 'https://github.com/coloredcow/employee-portal',
'resume' => 'https://github.com/coloredcow/employee-portal',
'form_data' => [
'data 1' => 'Sample content 1',
'data 2' => 'Sample content 2',
],
'job_title' => $job->title,
];
如何在php中实现此功能,然后调用它。创建函数后,请在另一个地方调用它。
答案 0 :(得分:0)
在您的应用文件夹中的helpers.php
文件中创建函数
function getCustomData()
{
$applicantAttr = [
'name' => 'Taylor Otwell',
'email' => 'vaibhav@coloredcow.com',
'phone' => '123321',
'college' => 'Sample college',
'graduation_year' => '2018',
'course' => 'Test Course',
'linkedin' => 'https://github.com/coloredcow/employee-portal',
'resume' => 'https://github.com/coloredcow/employee-portal',
'form_data' => [
'data 1' => 'Sample content 1',
'data 2' => 'Sample content 2',
],
'job_title' => $job->title,
];
return $applicantAttr;
}
并将此函数调用为:
getCustomData();