我从第三方API接收数据。
有时数据不是很好,并且有很多空格。
我尝试过使用ltrim()和preg_replace()而没有任何运气:
Cover Supervisors
'空白'总是在字符串的开头。以下内容直接从响应中复制:
string(1664) "Cover Supervisors
Leicester & Surrounding areas
£65 - £110 per day
Required for the New Term
Immediate Interviews
Clarence Recruitment is currently looking for Cover Supervisors to work in Secondary schools across the Leicester area.
• Do you have any experience of working with children 11-16yrs and have a good knowledge of the National Curriculum?
• Are you looking to have a future within the education sector?
• Would you like the freedom to choose the days you work?
We are currently experiencing a high demand for flexible, part time and full time secondary cover supervisors.
We are therefore looking to recruit temporary staff, ideally those who are looking to build a long term career in teaching and would like to gain further school based experience before starting a PGCE/SCITT or SD program.
We are currently working with numerous vacancies so if this position is not quite for you please do send us your CV to discuss other opportunities more suitable to your requirements.
Alan (your consultant) has been working the East Midlands Desk for over 5 years so his knowledge of the local schools is exceptional. He has also gained QTS so he knows the education system extremely well. Feel free to contact him for a more detailed chat about the roles we can help you fill.
Clarence Recruitment is committed to safeguarding and promoting the welfare of children and young people and expects all staff and volunteers to share this commitment. The successful candidate will be required to have an enhanced DBS check in line with the Government’s Keeping Children Safe in Education guidelines (2014)"
如果这有帮助的话。任何尝试的想法??
修改::
var_dump显示:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.sessionManagement().maximumSessions(1).expiredUrl("/login-expired.html").and().and()
.authorizeRequests().antMatchers("/superadmin/**").access("hasRole('ROLE_SUPER_ADMIN')").and()
.formLogin().loginPage("/signin.html").permitAll().failureUrl("/login-failed.html").permitAll()
.and().exceptionHandling().accessDeniedPage("/403").and().logout().permitAll().and()
.exceptionHandling().and().logout().logoutSuccessUrl("/logout.html").permitAll().and()
}
答案 0 :(得分:0)
这可能是不间断的空间鬼混。请尝试明确删除它们:
$job['description'] = str_replace(' ', '', preg_replace('/^\s+/S', ' ', $job['description']));
您也可以在中间添加htmlentities
,但这是否可以接受取决于您正在使用的数据。